[jboss-cvs] JBossAS SVN: r111134 - in trunk/weld-int/ejb: src/main/java/org/jboss/weld/integration/ejb/interceptor and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Apr 8 12:13:52 EDT 2011


Author: marius.bogoevici
Date: 2011-04-08 12:13:52 -0400 (Fri, 08 Apr 2011)
New Revision: 111134

Modified:
   trunk/weld-int/ejb/pom.xml
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/DelegatingInterceptorInvocationContext.java
Log:
JBAS-9266 Unwrap WeldException

Modified: trunk/weld-int/ejb/pom.xml
===================================================================
--- trunk/weld-int/ejb/pom.xml	2011-04-08 14:45:11 UTC (rev 111133)
+++ trunk/weld-int/ejb/pom.xml	2011-04-08 16:13:52 UTC (rev 111134)
@@ -23,6 +23,12 @@
     </dependency>
 
     <dependency>
+      <groupId>org.jboss.weld</groupId>
+      <artifactId>weld-core</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
       <groupId>org.jboss.ejb3</groupId>
       <artifactId>jboss-ejb3-common</artifactId>
       <scope>provided</scope>

Modified: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/DelegatingInterceptorInvocationContext.java
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/DelegatingInterceptorInvocationContext.java	2011-04-08 14:45:11 UTC (rev 111133)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/DelegatingInterceptorInvocationContext.java	2011-04-08 16:13:52 UTC (rev 111134)
@@ -26,6 +26,8 @@
 import javax.enterprise.inject.spi.Interceptor;
 import javax.interceptor.InvocationContext;
 
+import org.jboss.weld.exceptions.WeldException;
+
 public class DelegatingInterceptorInvocationContext implements InvocationContext
 {
 
@@ -74,7 +76,22 @@
          if (position<invocationQueue.size())
          {
             Object interceptorInstance = interceptorInstances.get(position);
-            return invocationQueue.get(position++).intercept(interceptionType, interceptorInstance, this);
+            try
+            {
+               return invocationQueue.get(position++).intercept(interceptionType, interceptorInstance, this);
+            }
+            catch (Exception e)
+            {
+               // Unwrap WeldException
+               if (e instanceof WeldException && e.getCause() instanceof Exception)
+               {
+                  throw ((Exception) e.getCause());
+               }
+               else
+               {
+                  throw e;
+               }
+            }
          }
          else
          {



More information about the jboss-cvs-commits mailing list