Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4988583

AutomaticException chaining for exception in try and exception thrown in finally

XMLWordPrintable

    • rc
    • x86
    • windows_xp
    • Verified

      Name: jl125535 Date: 02/04/2004


      A DESCRIPTION OF THE REQUEST :
      Currently, if an exception, A, occurs withing a try block, and then an exception B occurs in a finally block, then exception A is completely lost. Programmers can use manual exception chaining in situations where an exception may be thrown in a finally block. However, this can make the code very messy.

      JUSTIFICATION :
        From a debugging standpoint it would be useful to see the information from both exceptions without the need to add extra lines of code to do exception chaining.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I would Java to automatically using exception chaining behind the scenes in a situation where an exception occurs in a try block and a finally block.

      ACTUAL -

      So in the situation where a try block throws Exception A, and a finally block throws Exception B, if exception A and B occur then exception B is thrown with Exception A as its init cause.

      CUSTOMER SUBMITTED WORKAROUND :
      Use manual exception chaining.
      (Incident Review ID: 237013)
      ======================================================================

            abuckley Alex Buckley
            jleesunw Jon Lee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: