On Tue, Feb 27, 2001 at 08:20:11AM +0000, Sean Legassick wrote:
> Actually the patch below is only a little bit of what I want :-)

Actually it was a tiny if not non-existent bit of what I want :-)

The log only says 'InvocationTargetException' which isn't much help -
the patches below fix that and dig out the wrapped exception. I added a
patch for PropertyExecutor because this is just as relevant there.

BTW as regards adding proper exception propogation I'm willing to code
up some patches myself if the principle and the type of exception to
throw is agreed...

Sean


Index: ASTMethod.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java,v
retrieving revision 1.10
diff -u -r1.10 ASTMethod.java
--- ASTMethod.java      2001/01/03 05:26:27     1.10
+++ ASTMethod.java      2001/02/27 09:01:22
@@ -74,6 +74,7 @@
 package org.apache.velocity.runtime.parser.node;
 
 import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
 
 import java.io.*;
 
@@ -246,6 +247,12 @@
             
             return obj;
         }
+        catch (InvocationTargetException e)
+        {
+            Runtime.error("ASTMethod.execute() : invocation exception : " 
+                    + e.getTargetException() );
+            return null;
+        }            
         catch (Exception e)
         {
             return null;


Index: PropertyExecutor.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/PropertyExecutor.java,v
retrieving revision 1.4
diff -u -r1.4 PropertyExecutor.java
--- PropertyExecutor.java       2001/02/01 17:28:15     1.4
+++ PropertyExecutor.java       2001/02/27 09:03:13
@@ -55,8 +55,10 @@
 package org.apache.velocity.runtime.parser.node;
 
 import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
 
 import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.Runtime;
 
 /**
  * Returned the value of object property when executed.
@@ -126,6 +128,12 @@
                 return null;
             
             return method.invoke(o, null);
+        }
+        catch (InvocationTargetException e)
+        {
+            Runtime.error("PropertyExecutor: invocation exception " 
+                    + e.getTargetException());
+            return null;
         }
         catch (Exception e)
         {
-- 
Sean Legassick
[EMAIL PROTECTED]
      Hombre soy, nada humano me puede ser ajeno  
      
      

Reply via email to