2002/css-validator/org/w3c/css/parser CssPropertyFactory.java,1.17,1.18

Update of /sources/public/2002/css-validator/org/w3c/css/parser
In directory hutz:/tmp/cvs-serv18471/org/w3c/css/parser

Modified Files:
	CssPropertyFactory.java 
Log Message:
Formating the css version output so that css21 will be displayed as CSS 2.1
And if one day, there is css31 it'll be display CSS 3.1 as well

Index: CssPropertyFactory.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/CssPropertyFactory.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- CssPropertyFactory.java	6 Aug 2007 14:04:53 -0000	1.17
+++ CssPropertyFactory.java	7 Aug 2007 10:48:57 -0000	1.18
@@ -200,7 +200,7 @@
 		// this is an error... or a warning if it exists in another
 		// profile... FIXME
 		if (classname == null) {
-			throw new InvalidParamException("noexistence", property, ac.getCssVersion(), ac);
+			throw new InvalidParamException("noexistence", property, format(ac.getCssVersion()), ac);
 		}
 
 		CssIdent initial = new CssIdent("initial");
@@ -235,4 +235,17 @@
 			}
 		}
 	}
+
+	private String format(String cssVersion) {
+		if (!cssVersion.toLowerCase().startsWith("css"))
+			return cssVersion;
+		char number[] = cssVersion.substring(3).toCharArray();
+		String num = "CSS ";
+		for (int i = 0; i < number.length; ++i) {
+			num += number[i];
+			if (i != number.length - 1)
+				num += ".";
+		}
+		return num;
+	}
 }

Received on Tuesday, 7 August 2007 10:49:01 UTC