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/03/26 16:14:54 UTC

cvs commit: jakarta-velocity/src/java/org/apache/velocity/runtime/directive VMProxyArg.java

geirm       02/03/26 07:14:54

  Modified:    src/java/org/apache/velocity/runtime/directive
                        VMProxyArg.java
  Log:
  Fix to jon steven's bug : a vm in stringlit as arg to vm would cause NPE.
  
  Will let him test and then commit to the 1.3 branch as well.
  
  Revision  Changes    Path
  1.12      +12 -4     jakarta-velocity/src/java/org/apache/velocity/runtime/directive/VMProxyArg.java
  
  Index: VMProxyArg.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/directive/VMProxyArg.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- VMProxyArg.java	28 Feb 2002 05:24:24 -0000	1.11
  +++ VMProxyArg.java	26 Mar 2002 15:14:53 -0000	1.12
  @@ -61,6 +61,7 @@
   
   import org.apache.velocity.context.Context;
   import org.apache.velocity.context.InternalContextAdapter;
  +import org.apache.velocity.context.InternalContextAdapterImpl;
   import org.apache.velocity.runtime.RuntimeServices;
   import org.apache.velocity.runtime.parser.node.Node;
   import org.apache.velocity.runtime.parser.node.ASTReference;
  @@ -70,6 +71,7 @@
   import org.apache.velocity.util.StringUtils;
   
   import org.apache.velocity.exception.MethodInvocationException;
  +import org.apache.velocity.VelocityContext;
   
   /**
    *  The function of this class is to proxy for the calling parameter to the VM.
  @@ -113,7 +115,7 @@
    *  into a local context.
    *  
    *  @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
  - *  @version $Id: VMProxyArg.java,v 1.11 2002/02/28 05:24:24 geirm Exp $ 
  + *  @version $Id: VMProxyArg.java,v 1.12 2002/03/26 15:14:53 geirm Exp $ 
    */
   public class VMProxyArg
   {
  @@ -402,7 +404,7 @@
                   
                   constant = false;
   
  -                try 
  +                try
                   {
                       /*
                        *  fakie : wrap in  directive to get the parser to treat our args as args
  @@ -435,10 +437,16 @@
                       }
   
                       /*
  -                     *  init.  We can do this as they are only references
  +                     *  init.  be a good citizen and give it an ICA
                        */
   
  -                    nodeTree.init(null, rsvc);
  +                    InternalContextAdapter ica
  +                            = new InternalContextAdapterImpl(new VelocityContext());
  +
  +                    ica.pushCurrentTemplateName("VMProxyArg : "
  +                            + ParserTreeConstants.jjtNodeName[type]);
  +
  +                    nodeTree.init(ica, rsvc);
                   } 
                   catch ( Exception e ) 
                   {
  
  
  

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