Matthew Pitts created ARIES-1497:
------------------------------------

             Summary: jpa-support XAJpaTemplate does not properly handle 
RollbackException
                 Key: ARIES-1497
                 URL: https://issues.apache.org/jira/browse/ARIES-1497
             Project: Aries
          Issue Type: Bug
          Components: JPA
    Affects Versions: jpa-2.3.0
            Reporter: Matthew Pitts


There are a couple of problems addressed here: 

#. No checked exceptions ever reach the safeRollback method in XAJpaTemplate. 
This is due to the fact that safeFinish catches and wraps via wrapThrowable. 
This means that the shouldRollback logic will always (or almost always) be 
true, because no checked exceptions have the opportunity to bubble-up as-is 
from safeFinish.

#. Because of the above problem, javax.transaction.RollbackException events are 
not properly handled since they result in another rollback attempt.

The proposed fix (and patch) is to allow RollbackExceptions to bubble up from 
safeFinish, thus allowing for their direct passing to safeRollback. Basically, 
because this is a checked exception, shouldRollback will be false during 
safeRollback handling, thus preventing a rollback attempt while this exception 
is propagating. Additionally, because safeRollback calls safeFinish which 
ultimately calls the corresponding TransactionAttribute.finish method, then the 
logic therein to issue a rollback in the event of STATUS_MARKED_ROLLBACK will 
be executed when this exception is propagating. Thus, no other special handling 
is really required.

Please validate and correct my statement of the problem and my fix.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to