Uploaded image for project: 'JBoss Transaction Manager'
  1. JBoss Transaction Manager
  2. JBTM-530

Thrown Exceptions often loose the original cause

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 4.5.0
    • Transaction Core
    • None

      In JBossTM exceptions are often catched and left behind in favor of a new dedicated Exception (or Error) contextually thrown.
      This lead to a steady lack of information about the origin of the final symptom.

      As an example, see the following code snippet (extracted from com.arjuna.ats.internal.arjuna.objectstore.JDBCStore.JDBCStore())
      ...
      try

      { initialise(""); }

      catch (Exception e)

      { throw new ObjectStoreError(); }

      ...

      Here the original exception "e" is lost in favor of a new ObjectStoreError. No one will never know the cause of the thrown ObjectStoreError, nor see what's wrong without using a debugger (if ever available).

      Since I saw the binary distribution of JBossTM (at least version 4.5.0) is compiled for Java 1.5, I suppose you aren't denied to use the standard exception chaining mechanism introduced since Java 1.4 (namely the java.lang.Throwable.cause field)

      Please consider refactoring your code to chain the exception causes. It would be very useful.

            Unassigned Unassigned
            davidecavestro Davide Cavestro (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: