Author: markt
Date: Thu Jan 10 13:36:00 2008
New Revision: 610939

URL: http://svn.apache.org/viewvc?rev=610939&view=rev
Log:
Fix bug 43758. Prevent NPEs when scripting elements are empty

Modified:
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Node.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=610939&r1=610938&r2=610939&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Thu Jan 10 13:36:00 2008
@@ -31,12 +31,6 @@
   +1: jfclere
   -1: fhanik - Can we add the 'package' directive to make the package match 
the dir structure
 
-  Fix http://issues.apache.org/bugzilla/show_bug.cgi?id=43758
-  Prevent NPEs when scripting elements are empty
-  http://svn.apache.org/viewvc?rev=607903&view=rev
-  +1: markt, fhanik, pero
-  -1: 
-
   Fix possible NPE in previous fix for
   http://issues.apache.org/bugzilla/show_bug.cgi?id=43839
   http://svn.apache.org/viewvc?rev=609003&view=rev

Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Node.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Node.java?rev=610939&r1=610938&r2=610939&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Node.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Node.java Thu Jan 10 
13:36:00 2008
@@ -831,12 +831,17 @@
          */
         public String getText() {
             String ret = text;
-            if ((ret == null) && (body != null)) {
-                StringBuffer buf = new StringBuffer();
-                for (int i = 0; i < body.size(); i++) {
-                    buf.append(body.getNode(i).getText());
+            if (ret == null) {
+                if (body != null) {
+                    StringBuffer buf = new StringBuffer();
+                    for (int i = 0; i < body.size(); i++) {
+                        buf.append(body.getNode(i).getText());
+                    }
+                    ret = buf.toString();
+                } else {
+                    // Nulls cause NPEs further down the line
+                    ret = "";
                 }
-                ret = buf.toString();
             }
             return ret;
         }

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=610939&r1=610938&r2=610939&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Thu Jan 10 13:36:00 2008
@@ -169,6 +169,9 @@
         a scriptlet there is a one to one line mapping. (markt/jim)
       </fix>
       <fix>
+        <bug>43758</bug>: Fix NPE when scripting elements are empty. (markt)
+      </fix>
+      <fix>
         <bug>43909</bug>: Make sure locale maps to wrapped ELContext. Patch
         provided by Tuomas Kiviaho. (markt)
       </fix>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to