2002/css-validator/org/w3c/css/servlet CssValidator.java,1.46,1.47

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

Modified Files:
	CssValidator.java 
Log Message:
reworking profile/version check ot avoid doing too many string comparisons, and user defaulting

Index: CssValidator.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/servlet/CssValidator.java,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- CssValidator.java	29 Aug 2011 07:21:01 -0000	1.46
+++ CssValidator.java	14 Sep 2011 16:31:50 -0000	1.47
@@ -17,7 +17,6 @@
 import org.w3c.css.error.ErrorReport;
 import org.w3c.css.error.ErrorReportFactory;
 import org.w3c.css.index.IndexGenerator;
-import org.w3c.css.properties.PropertiesLoader;
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.Codecs;
 import org.w3c.css.util.FakeFile;
@@ -304,22 +303,11 @@
         }
 
         // CSS version
-        if (profile != null && (!"none".equals(profile) || "".equals(profile))) {
-            if ("css1".equals(profile) || "css2".equals(profile)
-                    || "css21".equals(profile)
-                    || "css3".equals(profile) || "svg".equals(profile)
-                    || "svgbasic".equals(profile) || "svgtiny".equals(profile)) {
-                ac.setCssVersion(profile);
-            } else {
-                ac.setProfile(profile);
-                ac.setCssVersion(PropertiesLoader.config.getProperty("defaultProfile"));
-            }
-        } else {
-            ac.setProfile("none");
-            ac.setCssVersion(PropertiesLoader.config.getProperty("defaultProfile"));
-        }
+        ac.setCssVersionAndProfile(profile.toLowerCase());
+
         if (Util.onDebug) {
-            System.err.println("[DEBUG]  profile is : " + ac.getCssVersion()
+            System.err.println("[DEBUG] version is : " + ac.getCssVersionString()
+                    + " profile is " + ac.getProfileString()
                     + " medium is " + usermedium);
         }
 
@@ -634,23 +622,8 @@
         // Allow vendor extensions to just show up as warnings.
         processVendorExtensionParameter(vendorExtensionAsWarnings, ac);
 
+        ac.setCssVersionAndProfile(profile.toLowerCase());
         // CSS version
-        if (profile != null && (!"none".equals(profile) || "".equals(profile))) {
-            if ("css1".equals(profile) || "css2".equals(profile)
-                    || "css21".equals(profile)
-                    || "css3".equals(profile) || "svg".equals(profile)
-                    || "svgbasic".equals(profile) || "svgtiny".equals(profile)) {
-                ac.setCssVersion(profile);
-            } else {
-                ac.setProfile(profile);
-                ac.setCssVersion(PropertiesLoader.config.getProperty(
-                        "defaultProfile"));
-            }
-        } else {
-            ac.setProfile("none");
-            ac.setCssVersion(PropertiesLoader.config.getProperty(
-                    "defaultProfile"));
-        }
         String fileName = "";
         InputStream is = null;
         boolean isCSS = false;

Received on Wednesday, 14 September 2011 16:32:07 UTC