You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by co...@apache.org on 2010/02/26 21:29:37 UTC
svn commit: r916811 -
/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
Author: covener
Date: Fri Feb 26 20:29:37 2010
New Revision: 916811
URL: http://svn.apache.org/viewvc?rev=916811&view=rev
Log:
OWB-305 when an exception bubbles up the interceptor, throw the actual
cause from proceed() and not the InvocationTargetException that
Method.invoke() has wrapped it in
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java?rev=916811&r1=916810&r2=916811&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java Fri Feb 26 20:29:37 2010
@@ -13,6 +13,7 @@
*/
package org.apache.webbeans.intercept;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
@@ -153,6 +154,22 @@
}
}
+ catch (InvocationTargetException ite)
+ {
+ this.target = null; // destroy target instance
+
+ // Try to provide the original exception to the interceptor stack,
+ // not the InvocationTargetException from Method.invoke
+ Throwable t = ite.getCause();
+ if (t instanceof Exception)
+ {
+ throw (Exception) t;
+ }
+ else
+ {
+ throw ite;
+ }
+ }
catch (Exception e)
{
this.target = null; // destroy target instance