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 2001/07/03 21:29:14 UTC

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

geirm       01/07/03 12:29:13

  Modified:    src/java/org/apache/velocity/runtime/directive
                        VelocimacroProxy.java
  Log:
  Fix to allow a MIE thrown in a VM to propogate all the way up and
  stop parsing.  This is the correct behavior.
  
  Thanks to michael salmone (ms@collab.net) for finding this...
  
  Revision  Changes    Path
  1.24      +13 -2     jakarta-velocity/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java
  
  Index: VelocimacroProxy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- VelocimacroProxy.java	2001/06/19 03:33:30	1.23
  +++ VelocimacroProxy.java	2001/07/03 19:29:09	1.24
  @@ -77,13 +77,15 @@
   import org.apache.velocity.runtime.parser.node.SimpleNode;
   import org.apache.velocity.util.StringUtils;
   
  +import org.apache.velocity.exception.MethodInvocationException;
  +
   /**
    *  VelocimacroProxy.java
    *
    *   a proxy Directive-derived object to fit with the current directive system
    *
    * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
  - * @version $Id: VelocimacroProxy.java,v 1.23 2001/06/19 03:33:30 geirm Exp $ 
  + * @version $Id: VelocimacroProxy.java,v 1.24 2001/07/03 19:29:09 geirm Exp $ 
    */
   public class VelocimacroProxy extends Directive
   {
  @@ -172,7 +174,7 @@
        *   Renders the macro using the context
        */
       public boolean render( InternalContextAdapter context, Writer writer, Node node)
  -        throws IOException
  +        throws IOException, MethodInvocationException
       {
           try 
           {
  @@ -219,6 +221,15 @@
           } 
           catch ( Exception e ) 
           {
  +            /*
  +             *  if it's a MIE, it came from the render.... throw it...
  +             */
  +
  +            if ( e instanceof MethodInvocationException)
  +            {
  +                throw (MethodInvocationException) e;
  +            }
  +
               Runtime.error("VelocimacroProxy.render() : exception VM = #" + macroName + 
               "() : "  + StringUtils.stackTrace(e));
           }