tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1154579 - in /tomcat/trunk/java/org/apache/jasper/compiler: JspUtil.java PageDataImpl.java Validator.java
Date Sat, 06 Aug 2011 20:28:35 GMT
Author: markt
Date: Sat Aug  6 20:28:35 2011
New Revision: 1154579

URL: http://svn.apache.org/viewvc?rev=1154579&view=rev
Log:
Fix some false npe warnings

Modified:
    tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java
    tomcat/trunk/java/org/apache/jasper/compiler/PageDataImpl.java
    tomcat/trunk/java/org/apache/jasper/compiler/Validator.java

Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java?rev=1154579&r1=1154578&r2=1154579&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java Sat Aug  6 20:28:35 2011
@@ -119,6 +119,7 @@ public class JspUtil {
         int tempLength = (attrs == null) ? 0 : attrs.getLength();
         Vector<String> temp = new Vector<String>(tempLength, 1);
         for (int i = 0; i < tempLength; i++) {
+            @SuppressWarnings("null")  // If attrs==null, tempLength == 0
             String qName = attrs.getQName(i);
             if ((!qName.equals("xmlns")) && (!qName.startsWith("xmlns:")))
                 temp.addElement(qName);

Modified: tomcat/trunk/java/org/apache/jasper/compiler/PageDataImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/PageDataImpl.java?rev=1154579&r1=1154578&r2=1154579&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/PageDataImpl.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/PageDataImpl.java Sat Aug  6 20:28:35 2011
@@ -510,6 +510,7 @@ class PageDataImpl extends PageData impl
             Attributes attrs = n.getAttributes();
             int len = (attrs == null) ? 0 : attrs.getLength();
             for (int i=0; i<len; i++) {
+                @SuppressWarnings("null")  // If attrs==null, len == 0
                 String attrName = attrs.getQName(i);
                 if (!"pageEncoding".equals(attrName)
                         && !"contentType".equals(attrName)) {
@@ -530,6 +531,7 @@ class PageDataImpl extends PageData impl
 
             // append remaining attributes
             for (int i=0; i<len; i++) {
+                @SuppressWarnings("null")  // If attrs==null, len == 0
                 String attrName = attrs.getQName(i);
                 if ("import".equals(attrName) || "contentType".equals(attrName)
                         || "pageEncoding".equals(attrName)) {
@@ -601,6 +603,7 @@ class PageDataImpl extends PageData impl
             Attributes attrs = n.getAttributes();
             int len = (attrs == null) ? 0 : attrs.getLength();
             for (int i=0; i<len; i++) {
+                @SuppressWarnings("null")  // If attrs==null, len == 0
                 String attrName = attrs.getQName(i);
                 if (!"pageEncoding".equals(attrName)) {
                     append = true;
@@ -696,6 +699,7 @@ class PageDataImpl extends PageData impl
             Attributes attrs = n.getTaglibAttributes();
             int len = (attrs == null) ? 0 : attrs.getLength();
             for (int i=0; i<len; i++) {
+                @SuppressWarnings("null")  // If attrs==null, len == 0
                 String name = attrs.getQName(i);
                 String value = attrs.getValue(i);
                 buf.append("  ").append(name).append("=\"").append(value).append("\"\n");
@@ -708,6 +712,7 @@ class PageDataImpl extends PageData impl
             len = (attrs == null) ? 0 : attrs.getLength();
             boolean defaultNSSeen = false;
             for (int i=0; i<len; i++) {
+                @SuppressWarnings("null")  // If attrs==null, len == 0
                 String name = attrs.getQName(i);
                 String value = attrs.getValue(i);
                 buf.append("  ").append(name).append("=\"").append(value).append("\"\n");
@@ -724,6 +729,7 @@ class PageDataImpl extends PageData impl
             attrs = n.getAttributes();
             len = (attrs == null) ? 0 : attrs.getLength();
             for (int i=0; i<len; i++) {
+                @SuppressWarnings("null")  // If attrs==null, len == 0
                 String name = attrs.getQName(i);
                 String value = attrs.getValue(i);
                 buf.append("  ").append(name).append("=\"");

Modified: tomcat/trunk/java/org/apache/jasper/compiler/Validator.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Validator.java?rev=1154579&r1=1154578&r2=1154579&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Validator.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Validator.java Sat Aug  6 20:28:35 2011
@@ -896,6 +896,7 @@ class Validator {
             if (attrs == null) {
                 err.jspError(n, "jsp.error.jspelement.missing.name");
             }
+            @SuppressWarnings("null") // Exception will have been thrown above
             int xmlAttrLen = attrs.getLength();
 
             Node.Nodes namedAttrs = n.getNamedAttributeNodes();



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message