Fix bug 43758. Return empty string rather than null to prevent the NPEs that happen...
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 1 Jan 2008 20:04:45 +0000 (20:04 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 1 Jan 2008 20:04:45 +0000 (20:04 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@607903 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/jasper/compiler/Node.java

index fc05627..f4a8d8f 100644 (file)
@@ -831,12 +831,17 @@ abstract class Node implements TagConstants {
          */
         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;
         }