You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2014/03/05 15:22:19 UTC

svn commit: r1574502 - /tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java

Author: markt
Date: Wed Mar  5 14:22:19 2014
New Revision: 1574502

URL: http://svn.apache.org/r1574502
Log:
FindBugs: Remove unnecessary null check

Modified:
    tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java

Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java?rev=1574502&r1=1574501&r2=1574502&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java Wed Mar  5 14:22:19 2014
@@ -317,55 +317,53 @@ class JspDocumentParser
         startMark = new Mark(ctxt, path, locator.getLineNumber(),
                              locator.getColumnNumber());
 
-        if (attrs != null) {
-            /*
-             * Notice that due to a bug in the underlying SAX parser, the
-             * attributes must be enumerated in descending order.
-             */
-            boolean isTaglib = false;
-            for (int i = attrs.getLength() - 1; i >= 0; i--) {
-                isTaglib = false;
-                String attrQName = attrs.getQName(i);
-                if (!attrQName.startsWith("xmlns")) {
-                    if (nonTaglibAttrs == null) {
-                        nonTaglibAttrs = new AttributesImpl();
+        /*
+         * Notice that due to a bug in the underlying SAX parser, the
+         * attributes must be enumerated in descending order.
+         */
+        boolean isTaglib = false;
+        for (int i = attrs.getLength() - 1; i >= 0; i--) {
+            isTaglib = false;
+            String attrQName = attrs.getQName(i);
+            if (!attrQName.startsWith("xmlns")) {
+                if (nonTaglibAttrs == null) {
+                    nonTaglibAttrs = new AttributesImpl();
+                }
+                nonTaglibAttrs.addAttribute(
+                    attrs.getURI(i),
+                    attrs.getLocalName(i),
+                    attrs.getQName(i),
+                    attrs.getType(i),
+                    attrs.getValue(i));
+            } else {
+                if (attrQName.startsWith("xmlns:jsp")) {
+                    isTaglib = true;
+                } else {
+                    String attrUri = attrs.getValue(i);
+                    // TaglibInfo for this uri already established in
+                    // startPrefixMapping
+                    isTaglib = pageInfo.hasTaglib(attrUri);
+                }
+                if (isTaglib) {
+                    if (taglibAttrs == null) {
+                        taglibAttrs = new AttributesImpl();
                     }
-                    nonTaglibAttrs.addAttribute(
+                    taglibAttrs.addAttribute(
                         attrs.getURI(i),
                         attrs.getLocalName(i),
                         attrs.getQName(i),
                         attrs.getType(i),
                         attrs.getValue(i));
                 } else {
-                    if (attrQName.startsWith("xmlns:jsp")) {
-                        isTaglib = true;
-                    } else {
-                        String attrUri = attrs.getValue(i);
-                        // TaglibInfo for this uri already established in
-                        // startPrefixMapping
-                        isTaglib = pageInfo.hasTaglib(attrUri);
-                    }
-                    if (isTaglib) {
-                        if (taglibAttrs == null) {
-                            taglibAttrs = new AttributesImpl();
-                        }
-                        taglibAttrs.addAttribute(
-                            attrs.getURI(i),
-                            attrs.getLocalName(i),
-                            attrs.getQName(i),
-                            attrs.getType(i),
-                            attrs.getValue(i));
-                    } else {
-                        if (nonTaglibXmlnsAttrs == null) {
-                            nonTaglibXmlnsAttrs = new AttributesImpl();
-                        }
-                        nonTaglibXmlnsAttrs.addAttribute(
-                            attrs.getURI(i),
-                            attrs.getLocalName(i),
-                            attrs.getQName(i),
-                            attrs.getType(i),
-                            attrs.getValue(i));
+                    if (nonTaglibXmlnsAttrs == null) {
+                        nonTaglibXmlnsAttrs = new AttributesImpl();
                     }
+                    nonTaglibXmlnsAttrs.addAttribute(
+                        attrs.getURI(i),
+                        attrs.getLocalName(i),
+                        attrs.getQName(i),
+                        attrs.getType(i),
+                        attrs.getValue(i));
                 }
             }
         }



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