BTM
  1. BTM
  2. BTM-108

Exception not handled properly in beforeCompletion event during commit()

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.1.1
    • Fix Version/s: 2.1.3
    • Labels:
      None
    • Patch Submitted:
      Yes
    • Number of attachments :
      0

      Description

      BitronixTransaction.fireBeforeCompletionEvent() is not surrounded by a try-catch block to catch RuntimeException so when this happens, the transaction is rolled back and its context isn't cleared (subsequent calls to begin() on the same thread result in an exception stating the nested transactions are not supported).

      in BitronixTransaction.commit() there is a line with only a call to fireBeforeCompletionEvent(). Replace it with this:

      try {
                  fireBeforeCompletionEvent();
              } catch (BitronixSystemException ex) {
                  if (log.isDebugEnabled()) log.debug("SystemException thrown during beforeCompletion cycle causing transaction rollback", ex);
                  rollback();
                  throw new BitronixRollbackException("SystemException thrown during beforeCompletion cycle caused transaction rollback", ex);
              } catch (RuntimeException ex) {
                  if (log.isDebugEnabled()) log.debug("RuntimeException thrown during beforeCompletion cycle causing transaction rollback", ex);
                  rollback();
                  throw new BitronixRollbackException("RuntimeException thrown during beforeCompletion cycle caused transaction rollback", ex);
              }
      

        Issue Links

          Activity

          Hide
          Ludovic Orban added a comment -

          Fixed.

          Show
          Ludovic Orban added a comment - Fixed.

            People

            • Assignee:
              Ludovic Orban
              Reporter:
              James House
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: