You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by ge...@apache.org on 2002/02/22 21:59:12 UTC

cvs commit: jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node ASTStringLiteral.java

geirm       02/02/22 12:59:12

  Modified:    src/java/org/apache/velocity/runtime/parser/node
                        ASTStringLiteral.java
  Log:
  Fix (I am pretty sure) for the high-stress bug reported by
  Stephane Bailliez <st...@haht.com>.  Should be safe - will do
  some load testing.  Easy to back out during the 1.3 release phases if
  a problem.
  
  Revision  Changes    Path
  1.13      +20 -25    jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java
  
  Index: ASTStringLiteral.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ASTStringLiteral.java	22 Oct 2001 03:53:25 -0000	1.12
  +++ ASTStringLiteral.java	22 Feb 2002 20:59:12 -0000	1.13
  @@ -69,7 +69,7 @@
    *
    * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
    * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
  - * @version $Id: ASTStringLiteral.java,v 1.12 2001/10/22 03:53:25 jon Exp $
  + * @version $Id: ASTStringLiteral.java,v 1.13 2002/02/22 20:59:12 geirm Exp $
    */
   public class ASTStringLiteral extends SimpleNode
   {
  @@ -131,6 +131,24 @@
   
           interpolateimage = image + " ";
   
  +        if ( interpolate )
  +        {
  +            /*
  +             *  now parse and init the nodeTree
  +             */
  +
  +            BufferedReader br = new BufferedReader( new StringReader( interpolateimage ));
  +
  +            nodeTree
  +                = rsvc.parse( br, context.getCurrentTemplateName() );
  +
  +            /*
  +             *  init with context. It won't modify anything
  +             */
  +
  +            nodeTree.init( context, rsvc );
  +        }
  +
           return data;
       }
   
  @@ -151,29 +169,7 @@
           if (interpolate )
           {          
               try
  -            {   
  -                /*
  -                 *  only parse the first time
  -                 */
  -
  -                if (nodeTree == null)
  -                {
  -                    /*
  -                     *  parse the stringlit
  -                     */
  -                    
  -                    BufferedReader br = new BufferedReader( new StringReader( interpolateimage ));
  -
  -                    nodeTree 
  -                        = rsvc.parse( br,context.getCurrentTemplateName() );        
  -                
  -                    /*
  -                     *  init with context. It won't modify anything
  -                     */
  -
  -                    nodeTree.init( context, rsvc );
  -                }
  -
  +            {
                   /*
                    *  now render against the real context
                    */
  @@ -192,7 +188,6 @@
                    */
   
                   return ret.substring(0, ret.length() - 1 );
  -
               }
               catch( Exception e )
               {
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>