[ 
https://issues.apache.org/jira/browse/OWB-575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mark Struberg updated OWB-575:
------------------------------

    Fix Version/s:     (was: 1.1.1)
                   1.2.0

> ResourceProxyHandler.invoke should unwrap and throw the underlying cause of 
> the InvocationTargetException
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: OWB-575
>                 URL: https://issues.apache.org/jira/browse/OWB-575
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Java EE Integration, TCK
>    Affects Versions: 1.1.0, 1.0.0
>         Environment: any
>            Reporter: Rohit Dilip Kelapure
>            Assignee: Gurkan Erdogdu
>             Fix For: 1.2.0
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> 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
>       {
>          entityManager.getTransaction(); // <--
>          entityManagerValid = false;
>       }
>       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 {
>                       rc = actualMethod.invoke(this.actualResource, args);
>               } catch (InvocationTargetException ite) {
>                       throw ite.getCause();
>               } catch (IllegalArgumentException e) {
>                       throw e.getCause();
>               } catch (IllegalAccessException e) {
>                       throw e.getCause();
>               }
>               return rc;
>     }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to