geirm       01/03/19 09:14:49

  Modified:    src/java/org/apache/velocity/runtime/parser/node Node.java
                        SimpleNode.java
  Log:
  Base classes for other nodes, made changes to support proper propagation of
  MethodInvocationExceptions when an object in the context throws and
  exception during render time.
  
  Revision  Changes    Path
  1.6       +13 -6     
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/Node.java
  
  Index: Node.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/Node.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Node.java 2001/01/03 05:27:38     1.5
  +++ Node.java 2001/03/19 17:14:46     1.6
  @@ -2,7 +2,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -24,7 +24,7 @@
    *    Alternately, this acknowlegement may appear in the software itself,
    *    if and wherever such third-party acknowlegements normally appear.
    *
  - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
  + * 4. The names "The Jakarta Project", "Velocity", and "Apache Software
    *    Foundation" must not be used to endorse or promote products derived
    *    from this software without prior written permission. For written
    *    permission, please contact [EMAIL PROTECTED]
  @@ -62,6 +62,8 @@
   import org.apache.velocity.runtime.parser.Parser;
   import org.apache.velocity.runtime.parser.Token;
   
  +import org.apache.velocity.exception.MethodInvocationException;
  +
   /**
    *  All AST nodes must implement this interface.  It provides basic
    *  machinery for constructing the parent and child relationships
  @@ -116,14 +118,19 @@
       public int getType();
   
       public Object init( InternalContextAdapter context, Object data) throws 
Exception;
  +
  +    public boolean evaluate( InternalContextAdapter context)
  +        throws MethodInvocationException;
   
  -    public boolean evaluate( InternalContextAdapter context);
  -    public Object value( InternalContextAdapter context);
  +    public Object value( InternalContextAdapter context)
  +        throws MethodInvocationException;
   
       public boolean render( InternalContextAdapter context, Writer writer)
  -        throws IOException;
  +        throws IOException,MethodInvocationException;
  +
  +    public Object execute(Object o, InternalContextAdapter context)
  +      throws MethodInvocationException;
   
  -    public Object execute(Object o, InternalContextAdapter context);
       public void setInfo(int info);
       public int getInfo();
   
  
  
  
  1.9       +8 -3      
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/SimpleNode.java
  
  Index: SimpleNode.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/SimpleNode.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SimpleNode.java   2001/01/03 05:27:38     1.8
  +++ SimpleNode.java   2001/03/19 17:14:47     1.9
  @@ -2,7 +2,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -24,7 +24,7 @@
    *    Alternately, this acknowlegement may appear in the software itself,
    *    if and wherever such third-party acknowlegements normally appear.
    *
  - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
  + * 4. The names "The Jakarta Project", "Velocity", and "Apache Software
    *    Foundation" must not be used to endorse or promote products derived
    *    from this software without prior written permission. For written
    *    permission, please contact [EMAIL PROTECTED]
  @@ -65,6 +65,8 @@
   import org.apache.velocity.runtime.parser.Token;
   import org.apache.velocity.runtime.parser.ParserTreeConstants;
   
  +import org.apache.velocity.exception.MethodInvocationException;
  +
   public class SimpleNode implements Node
   {
       protected Node parent;
  @@ -237,17 +239,19 @@
       }
   
       public boolean evaluate( InternalContextAdapter  context)
  +        throws MethodInvocationException
       {
           return false;
       }        
   
       public Object value( InternalContextAdapter context)
  +        throws MethodInvocationException
       {
           return null;
       }        
   
       public boolean render( InternalContextAdapter context, Writer writer)
  -        throws IOException
  +        throws IOException, MethodInvocationException
       {
           int i, k = jjtGetNumChildren();
   
  @@ -258,6 +262,7 @@
       }
   
       public Object execute(Object o, InternalContextAdapter context)
  +      throws MethodInvocationException
       {
           return null;
       }
  
  
  

Reply via email to