Author: alessio.soldano(a)jboss.com
Date: 2013-07-12 09:06:02 -0400 (Fri, 12 Jul 2013)
New Revision: 17776
Modified:
container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/invocation/AbstractInvocationHandlerEJB.java
Log:
[JBWS-3601] Porting WFLY-1667 fix to AS 7.1.3 ASIL
Modified:
container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/invocation/AbstractInvocationHandlerEJB.java
===================================================================
---
container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/invocation/AbstractInvocationHandlerEJB.java 2013-07-12
12:35:20 UTC (rev 17775)
+++
container/jboss71/branches/jbossws-jboss713/server-integration/src/main/java/org/jboss/as/webservices/invocation/AbstractInvocationHandlerEJB.java 2013-07-12
13:06:02 UTC (rev 17776)
@@ -25,9 +25,14 @@
import static
org.jboss.as.webservices.metadata.model.EJBEndpoint.EJB_COMPONENT_VIEW_NAME;
import static org.jboss.as.webservices.util.ASHelper.getMSCService;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
import java.util.Collection;
+import javax.management.MBeanException;
+import javax.xml.ws.soap.SOAPFaultException;
+
import org.jboss.as.ee.component.Component;
import org.jboss.as.ee.component.ComponentView;
import org.jboss.as.naming.ManagedReference;
@@ -121,6 +126,33 @@
onAfterInvocation(wsInvocation);
}
}
+
+ protected void handleInvocationException(final Throwable t) throws Exception {
+ if (t instanceof MBeanException) {
+ throw ((MBeanException) t).getTargetException();
+ }
+ if (t instanceof Exception) {
+ SOAPFaultException ex = findSoapFaultException(t);
+ if(ex != null) {
+ throw new InvocationTargetException(ex);
+ }
+ throw (Exception)t;
+ }
+ if (t instanceof Error) {
+ throw (Error) t;
+ }
+ throw new UndeclaredThrowableException(t);
+ }
+
+ protected SOAPFaultException findSoapFaultException(Throwable ex) {
+ if (ex instanceof SOAPFaultException) {
+ return (SOAPFaultException)ex;
+ }
+ if (ex.getCause() != null) {
+ return findSoapFaultException(ex.getCause());
+ }
+ return null;
+ }
/**
* Translates SEI method to EJB view method.