- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Mon, 26 Sep 2011 14:32:18 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/util In directory hutz:/tmp/cvs-serv16740/org/w3c/css/util Modified Files: ApplContext.java Log Message: fix a NPE when profile is not given Index: ApplContext.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/util/ApplContext.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- ApplContext.java 17 Sep 2011 06:02:27 -0000 1.21 +++ ApplContext.java 26 Sep 2011 14:32:16 -0000 1.22 @@ -202,8 +202,14 @@ // TODO should we check profile first and if SVG or MOBILE // set specific version of CSS (like CSS2 and not CSS21 for MOBILE) ? - version = CssVersion.resolve(this, spec); - profile = CssProfile.resolve(this, spec); + if ((spec == null) || spec.isEmpty()) { + version = CssVersion.getDefault(); + profile = CssProfile.EMPTY; + } else { + String low = spec.toLowerCase(); + version = CssVersion.resolve(this, low); + profile = CssProfile.resolve(this, low); + } } public void setOrigin(int origin) { @@ -445,7 +451,7 @@ namespaces = new HashMap<URL, HashMap<String, String>>(); } // reformat the prefix if null. - if ((prefix == null) || prefix.length() == 0) { + if ((prefix == null) || prefix.isEmpty()) { prefix = defaultPrefix; } @@ -469,7 +475,7 @@ if (prefix.equals("*")) { // any ns, always true return true; } - if (prefix.length() == 0) { + if (prefix.isEmpty()) { prefix = "*defaultprefix*"; } HashMap<String, String> nsdefs = namespaces.get(url);
Received on Monday, 26 September 2011 14:32:23 UTC