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

{ExceptionInInitializer/InvocationTarget} exceptions must show 2 stack traces

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.2.0
    • 1.1, 1.1.2, 1.1.3
    • core-libs
    • None
    • 1.2beta4
    • x86, sparc
    • solaris_2.5.1, windows_95, windows_nt
    • Not verified

      The ExceptionInInitializerError stack trace only goes to the initialization
      in which the exception occurred. I usually need to see the original exception
      to actually fix the problem, but that is only stored in the exception -- it is
      not displayed. I include below my fix, which is to modify the exception's
      printStackTrace methods to print the nested exception's stack trace, but other
      solutions exist. Please do something about it.
          public void printStackTrace() {
              printStackTrace(System.err);
          }
       
          public void printStackTrace(PrintWriter s) {
              super.printStackTrace(s);
              s.println("Exception was ");
              exception.printStackTrace(s);
          }
       
          public void printStackTrace(PrintStream s) {
              super.printStackTrace(s);
              s.println("Exception was ");
              exception.printStackTrace(s);
          }

            apalanissunw Anand Palaniswamy (Inactive)
            karnoldsunw Kenneth Arnold (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: