velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From by...@apache.org
Subject svn commit: r731656 - /velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTText.java
Date Mon, 05 Jan 2009 19:38:39 GMT
Author: byron
Date: Mon Jan  5 11:38:38 2009
New Revision: 731656

URL: http://svn.apache.org/viewvc?rev=731656&view=rev
Log:
VELOCITY-644 Reversed the changes back to pre 644, t.image cannot be set to null without affecting
literal

Modified:
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTText.java

Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTText.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTText.java?rev=731656&r1=731655&r2=731656&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTText.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTText.java Mon
Jan  5 11:38:38 2009
@@ -32,7 +32,7 @@
  */
 public class ASTText extends SimpleNode
 {
-    private char[] ctext = null;
+    private char[] ctext;
 
     /**
      * @param id
@@ -65,15 +65,13 @@
     public Object init( InternalContextAdapter context, Object data)
     throws TemplateInitException
     {
-        // In case init gets called more then once.
-        if (ctext == null)
-        {
-            Token t = getFirstToken();
-            // In most cases tokenLiteral() will return back t.image, we want to use t.image
directly
-            // and not a copy because otherwise this would mean all text nodes are stored
twice.
-            ctext = NodeUtils.tokenLiteral(getFirstToken()).toCharArray();
-        }
-        return data;        
+        Token t = getFirstToken();
+
+        String text = NodeUtils.tokenLiteral( t );
+
+        ctext = text.toCharArray();
+
+        return data;
     }
 
     /**



Mime
View raw message