tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Romain Manni-Bucau (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (TOMEE-2051) JTA 1.2 compliance: @Transactional.rollbackOn regression
Date Fri, 02 Jun 2017 12:59:04 GMT

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

Romain Manni-Bucau resolved TOMEE-2051.
---------------------------------------
       Resolution: Fixed
         Assignee: Romain Manni-Bucau
    Fix Version/s: 7.0.4

Thanks! I fixed this one (realized what the bug was in between). Feel free to open github
PR if it is easier for you or ask for help if you need anything! Would be very happy to guide
you.

> JTA 1.2 compliance: @Transactional.rollbackOn regression
> --------------------------------------------------------
>
>                 Key: TOMEE-2051
>                 URL: https://issues.apache.org/jira/browse/TOMEE-2051
>             Project: TomEE
>          Issue Type: Bug
>            Reporter: Svetlin Zarev
>            Assignee: Romain Manni-Bucau
>             Fix For: 7.0.4
>
>
> We introduced a regression with (I guess)  TOMEE-2049.
> Test cases (transnational bean methods):
> {code}
> //[1] Does not work - transaction is not marked for roll back
>     @Transactional(rollbackOn = RollBackException.class)
>     public void withRollBackOnWithDeclaredRuntimeException() throws RollBackException
{
>         throw new RollBackException("Roll back because of me! - exception declared in
throws clause");
>     }
> //[2]Works as expected
>     @Transactional(rollbackOn = RollBackException.class)
>     public void withRollBackOnWithoutDeclaredRuntimeException() {
>         throw new RollBackException("Roll back because of me! - exception not declared
in throws clause");
>     }
> {code}
> Where RollbackException is a **RuntimeException**.
> In the case where the runtime exception is declared in the throws clause, the transaction
is not rolled back, although rollbackOn=RollbackException is set.
> The root cause is in 
> {code}
>         private static boolean isNotChecked(final Exception e, final Class<?>[]
exceptionTypes) {
>             return RuntimeException.class.isInstance(e) && (exceptionTypes.length
== 0 || !asList(exceptionTypes).contains(e.getClass()));
>         }
> {code}
> Here *exceptionTypes* is the passed value of "method.getExceptionTypes()" passed from
InterceptorBase:104



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message