Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-1963

Original exception lost in CommitAfterWorker upon abort

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 5.3.3
    • 5.3.4, 5.4
    • tapestry-hibernate
    • None

    Description

      advise() in CommitAfterWorker surrounds the method invocation and session commit in a try/catch and runs manager.abort() if a RuntimeException is caught and then rethrows the RuntimeException. The problem is, depending on the original problem, it is not unlikely that manager.abort() itself could throw an exception (Transaction Not Started, Transaction Already Started, etc.). When that happens, the original RuntimeException is lost and all we get is the useless exception generated by the call to manager.abort().

      I think we should just throw away any exceptions generated by manager.abort() so that we always retain the original RuntimeException. Something like this:

      try
      {
      invocation.proceed();
      // Success or checked exception:
      manager.commit();
      }
      catch (RuntimeException ex)
      {
      try

      { manager.abort(); }

      catch (Exception e)

      { // throw away; we want the real "ex" exception to get rethrown }

      throw ex;
      }

      Attachments

        Activity

          People

            hlship Howard Lewis Ship
            dotteben Ben Dotte
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: