geirm       02/02/23 02:52:23

  Modified:    src/java/org/apache/velocity/runtime/parser/node
                        ASTStringLiteral.java
  Log:
  Small fix for bug noted by Victor Salaman - beacuse we now do init-time
  parsing, it's possible to have a null context for the init(), so
  just check if that's the case and substitute for the template name in
  parse()
  
  Revision  Changes    Path
  1.15      +8 -3      
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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ASTStringLiteral.java     22 Feb 2002 21:46:00 -0000      1.14
  +++ ASTStringLiteral.java     23 Feb 2002 10:52:23 -0000      1.15
  @@ -69,7 +69,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Geir Magnusson Jr.</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
  - * @version $Id: ASTStringLiteral.java,v 1.14 2002/02/22 21:46:00 jon Exp $
  + * @version $Id: ASTStringLiteral.java,v 1.15 2002/02/23 10:52:23 geirm Exp $
    */
   public class ASTStringLiteral extends SimpleNode
   {
  @@ -139,8 +139,13 @@
   
               BufferedReader br = new BufferedReader(new 
StringReader(interpolateimage));
   
  -            nodeTree
  -                = rsvc.parse(br, context.getCurrentTemplateName());
  +            /*
  +             * it's possible to not have an initialization context - or we don't
  +             * want to trust the caller - so have a fallback value if so
  +             */
  +
  +            nodeTree  = rsvc.parse(br, (context != null) ?
  +                    context.getCurrentTemplateName() : "StringLiteral");
   
               /*
                *  init with context. It won't modify anything
  
  
  

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

Reply via email to