tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r607903 - /tomcat/trunk/java/org/apache/jasper/compiler/Node.java
Date Tue, 01 Jan 2008 20:04:45 GMT
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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message