W3C home > Mailing lists > Public > www-validator-cvs@w3.org > September 2011

2002/css-validator/org/w3c/css/values CssColorCSS1.java,1.15,1.16

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Mon, 26 Sep 2011 14:32:19 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1R8CEF-0004NL-0V@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/values
In directory hutz:/tmp/cvs-serv16740/org/w3c/css/values

Modified Files:
	CssColorCSS1.java 
Log Message:
fix a NPE when profile is not given

Index: CssColorCSS1.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/CssColorCSS1.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- CssColorCSS1.java	5 Jan 2010 19:49:51 -0000	1.15
+++ CssColorCSS1.java	26 Sep 2011 14:32:16 -0000	1.16
@@ -160,7 +160,7 @@
  */
 public class CssColorCSS1 extends CssColor {
 
-    private static HashMap<String,Object> definedColorsCSS1;
+    private static HashMap<String,RGB> definedColorsCSS1;
 
     /**
      * Create a new CssColorCSS1
@@ -186,20 +186,15 @@
     private void setIdentColor(String s, ApplContext ac)
 	    throws InvalidParamException {
 	String lower_s = s.toLowerCase();
-	Object obj = definedColorsCSS1.get(lower_s);
-	if (obj != null) {
-	    if (obj instanceof RGB) {
+	rgb = definedColorsCSS1.get(lower_s);
+	if (rgb != null) {
 		color = lower_s;
-		rgb = (RGB) obj;
-	    } else if (obj instanceof String) {
-		color = (String) obj;
-// 2007-05 - this warning on color string capitalization is plain silly, 
+// 2007-05 - this warning on color string capitalization is plain silly,
 // commenting it out-- ot@w3.org
 //		if (!obj.equals(s)) {
 //		    ac.getFrame().addWarning("color.mixed-capitalization",
 //					     s);
 //		}
-	    }
 	    return;
 	}
 
@@ -207,7 +202,7 @@
     }
 
     static {
-	definedColorsCSS1 = new HashMap<String,Object>();
+	definedColorsCSS1 = new HashMap<String,RGB>();
 	definedColorsCSS1.put("black",
 			  new RGB(0, 0, 0));
 	definedColorsCSS1.put("silver",
Received on Monday, 26 September 2011 14:32:20 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:46 UTC