Author: markt
Date: Tue Jan  1 12:04:45 2008
New Revision: 607903

URL: http://svn.apache.org/viewvc?rev=607903&view=rev
Log:
Fix bug 43758. Return empty string rather than null to prevent the NPEs that 
happen otherwise.

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

Modified: tomcat/trunk/java/org/apache/jasper/compiler/Node.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Node.java?rev=607903&r1=607902&r2=607903&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Node.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Node.java Tue Jan  1 12:04:45 
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;
         }



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

Reply via email to