[jboss-cvs] JBossAS SVN: r111086 - projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/mdb/inflow.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Apr 1 09:05:50 EDT 2011


Author: wolfc
Date: 2011-04-01 09:05:49 -0400 (Fri, 01 Apr 2011)
New Revision: 111086

Modified:
   projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/mdb/inflow/MessageInflowLocalProxy.java
Log:
JBPAPP-5516: treat exceptions that are not declared in the throwable clause of the inflow method as UndeclaredThrowableException


Modified: projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/mdb/inflow/MessageInflowLocalProxy.java
===================================================================
--- projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/mdb/inflow/MessageInflowLocalProxy.java	2011-04-01 00:37:31 UTC (rev 111085)
+++ projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/mdb/inflow/MessageInflowLocalProxy.java	2011-04-01 13:05:49 UTC (rev 111086)
@@ -23,6 +23,7 @@
 
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.resource.ResourceException;
@@ -263,7 +264,18 @@
          throw new ResourceException(t);
       }
    }
-   
+
+   private static boolean checked(Method method, Class<?> exceptionType)
+   {
+      final Class<?>[] allowedExceptionTypes = method.getExceptionTypes();
+      for (Class<?> allowedExceptionType : allowedExceptionTypes)
+      {
+         if (allowedExceptionType.isAssignableFrom(exceptionType))
+            return true;
+      }
+      return false;
+   }
+
    /**
     * Delivery.
     * 
@@ -302,6 +314,11 @@
       {
          if (trace)
             log.trace("MessageEndpoint " + getProxyString(proxy) + " delivery error", t);
+         if (t instanceof Exception)
+         {
+            if (!(t instanceof RuntimeException) && !checked(method, t.getClass()))
+               t = new UndeclaredThrowableException(t);
+         }
          if (t instanceof Error || t instanceof RuntimeException)
          {
             if (transaction != null)



More information about the jboss-cvs-commits mailing list