Uploaded image for project: 'Aries'
  1. Aries
  2. ARIES-1497

jpa-support XAJpaTemplate does not properly handle RollbackException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • jpa-2.3.0
    • None
    • JPA
    • None
    • Patch

    Description

      There are a couple of problems addressed here:

      1. 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.

      2. 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.

      Attachments

        Activity

          People

            cschneider Christian Schneider
            invinity Matthew Pitts
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: