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

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

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

Index: CssValidator.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/servlet/CssValidator.java,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- CssValidator.java	14 Sep 2011 16:31:50 -0000	1.47
+++ CssValidator.java	26 Sep 2011 14:32:16 -0000	1.48
@@ -117,7 +117,7 @@
 
         pval = config.getInitParameter("debug");
 
-        if (pval != null && pval.length()!=0) {
+        if (pval != null && !pval.isEmpty()) {
             // servlet debug mode
             // define a boolean property CSS.StyleSheet.debug if you want more
             // debug.
@@ -130,12 +130,12 @@
         }
 
         pval = config.getInitParameter("import");
-        if (pval != null && pval.length()!=0 && pval.equals("false")) {
+        if (pval != null && !pval.isEmpty() && pval.equals("false")) {
             Util.importSecurity = true;
         }
 
         pval = config.getInitParameter("entitysize");
-        if (pval != null && pval.length()!=0) {
+        if (pval != null && !pval.isEmpty()) {
             try {
                Util.maxEntitySize = Long.parseLong(pval);
             } catch (NumberFormatException nfe) {
@@ -167,7 +167,7 @@
     private void processVendorExtensionParameter(
             String vendorExtensionParameter, ApplContext context) {
         if (vendorExtensionParameter == null ||
-                vendorExtensionParameter.length() == 0) {
+                vendorExtensionParameter.isEmpty()) {
             vendorExtensionParameter =
                     getServletConfig().getInitParameter("vendorExtensionsAsWarnings");
         }
@@ -235,7 +235,7 @@
             lang = null;
         }
 
-        if (lang == null || lang.length()==0) {
+        if (lang == null || lang.isEmpty()) {
             lang = req.getHeader("Accept-Language");
         } else {
             lang += ',' + req.getHeader("Accept-Language");
@@ -278,7 +278,7 @@
             ac.setCredential(credential);
         }
 
-        if (usermedium == null || usermedium.length()==0) {
+        if (usermedium == null || usermedium.isEmpty()) {
             usermedium = "all";
         }
 
@@ -303,7 +303,7 @@
         }
 
         // CSS version
-        ac.setCssVersionAndProfile(profile.toLowerCase());
+        ac.setCssVersionAndProfile(profile);
 
         if (Util.onDebug) {
             System.err.println("[DEBUG] version is : " + ac.getCssVersionString()
@@ -563,7 +563,7 @@
                     profile = (String) tmp[i].getValue();
                 } else if (tmp[i].getName().equals("usermedium")) {
                     usermedium = (String) tmp[i].getValue();
-                    if (usermedium == null || usermedium.length()==0) {
+                    if (usermedium == null || usermedium.isEmpty()) {
                         usermedium = "all";
                     }
                 } else if (tmp[i].getName().equals("vextwarning")) {
@@ -576,7 +576,7 @@
         }
 
 
-        if (lang == null || lang.length()==0) {
+        if (lang == null || lang.isEmpty()) {
             lang = req.getHeader("Accept-Language");
         } else {
             lang += ',' + req.getHeader("Accept-Language");
@@ -590,7 +590,7 @@
             output = texthtml;
         }
         if ((file == null || file.getSize() == 0) &&
-                (text == null || text.length() == 0)) {
+                (text == null || text.isEmpty())) {
             // res.sendError(res.SC_BAD_REQUEST,
             // "You have send an invalid request");
             handleError(res, ac, output, "No file",
@@ -622,7 +622,7 @@
         // Allow vendor extensions to just show up as warnings.
         processVendorExtensionParameter(vendorExtensionAsWarnings, ac);
 
-        ac.setCssVersionAndProfile(profile.toLowerCase());
+        ac.setCssVersionAndProfile(profile);
         // CSS version
         String fileName = "";
         InputStream is = null;

Received on Monday, 26 September 2011 14:32:24 UTC