You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Romain Manni-Bucau (JIRA)" <ji...@apache.org> on 2017/06/02 12:42:04 UTC
[jira] [Commented] (TOMEE-2051) JTA 1.2 compliance:
@Transactional.rollbackOn regression
[ https://issues.apache.org/jira/browse/TOMEE-2051?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16034625#comment-16034625 ]
Romain Manni-Bucau commented on TOMEE-2051:
-------------------------------------------
@Svetlin: seems you know very well that part, want to enhance the test suite and do a PR all at once? Can be easier maybe and more fun for 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
>
> 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)