tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1427846 - /tomcat/trunk/java/org/apache/jasper/tagplugins/jstl/core/ForEach.java
Date Wed, 02 Jan 2013 16:22:05 GMT
Author: markt
Date: Wed Jan  2 16:22:05 2013
New Revision: 1427846

URL: http://svn.apache.org/viewvc?rev=1427846&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54242
Fix NPE in tagPlugins:ForEach when iteration is null. JSTL spec says it should be treated
like an empty iteration.

Modified:
    tomcat/trunk/java/org/apache/jasper/tagplugins/jstl/core/ForEach.java

Modified: tomcat/trunk/java/org/apache/jasper/tagplugins/jstl/core/ForEach.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/tagplugins/jstl/core/ForEach.java?rev=1427846&r1=1427845&r2=1427846&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/tagplugins/jstl/core/ForEach.java (original)
+++ tomcat/trunk/java/org/apache/jasper/tagplugins/jstl/core/ForEach.java Wed Jan  2 16:22:05
2013
@@ -155,6 +155,9 @@ public final class ForEach implements Ta
         ctxt.generateJavaSource("else if (" + itemsV + " instanceof Map)");
         ctxt.generateJavaSource(iterV + "=((Map)" + itemsV + ").entrySet().iterator();");
 
+        // Not null
+        ctxt.generateJavaSource("if (" + iterV + " != null) {");
+
         if (hasBegin) {
             String tV = ctxt.getTemporaryVariableName();
             ctxt.generateJavaSource("for (int " + tV + "=" + beginV + ";" +
@@ -196,6 +199,7 @@ public final class ForEach implements Ta
             ctxt.generateJavaSource("break;");
         }
         ctxt.generateJavaSource("}"); // while
+        ctxt.generateJavaSource("}"); // Not Null
     }
 
     /**



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


Mime
View raw message