Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0.0, 1.1.0
-
None
-
any
Description
Right now the ResourceProxyHandler simply rethrows the exception resulting from an invoke.
There may be cases where the ResourceProxyHandler needs to throw the root cause of the exception upstream instead of the wrapped InvocationException.
ResourceProxyHandler.invoke needs to unwrap the root cause exception from the invoke and pass it up the chain since.
This change is conceptually similar to https://issues.apache.org/jira/browse/OWB-554
This defect is needed to resolve a org.jboss.jsr299.tck.tests.implementation.simple.resource.persistenceContext.PersistenceContextInjectionTest TCK failure since the TCK looks for the IllegalStateException as noted below.
try
catch (IllegalStateException e)
{ // an IllegalStateException is the expected result if this is a JTA entityManager }An IllegalStateException is not caught though - because it looks like it is being wrapped by a java.lang.reflect.InvocationTargetException.
proposed Fix:
@Override
public Object invoke(Object self, Method actualMethod, Method proceed, Object[] args) throws Throwable
{
Object rc = null;
try
catch (InvocationTargetException ite)
{ throw ite.getCause(); }catch (IllegalArgumentException e)
{ throw e.getCause(); } catch (IllegalAccessException e) { throw e.getCause(); } return rc;
}