Uploaded image for project: 'Seam 2'
  1. Seam 2
  2. JBSEAM-2244

SpringTransaction doesn't pass the exception stack to the exception handler

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Done
    • Affects Version/s: 2.0.0.GA
    • Fix Version/s: 2.0.1.CR1
    • Component/s: Spring
    • Labels:
      None

      Description

      currently if a tx will be rollbacked, the SpringTransaction class kind of swallow the root cause in the following code

      Code:

      catch (TransactionSystemException e)

      { log.error("Exception cause:", e); throw new SystemException(e.getMessage()); }

      catch (UnexpectedRollbackException e)

      { log.error("Exception cause:", e); throw new RollbackException(e.getMessage()); }

      The problem is that the SystemException and RollbackException defined in JTA seem not to be able to take the case exception. But it is essential to pass the whole cause exception in SystemException and RollbackException instead of only a text message.

      My use case is the following:
      JSF delete action method tries to delete a row in the db. When the tx commits, it discovers the row can not be deleted because of foreign key constraint. I would like to have the ConstraintViolationException wrapped in the RollbackException, so that I have a chance to handle this exception later with the exception handler.

      In the current implmenetation, the RollbacklException with only text message and no cause stack will later be wrapped as an IllegalStateException, which is not helpful for exception handling at all.

      Please make the cause exception somehow accessible (ThreadLocal, or Seam Event Context), so that the error handling mechanism has a chance to do an exception handling.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                youngm youngm
                Reporter:
                dapeng dapeng wang
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: