JDK-4086279 : {ExceptionInInitializer/InvocationTarget} exceptions must show 2 stack traces
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.1,1.1.2,1.1.3
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_2.5.1,windows_95,windows_nt
  • CPU: x86,sparc
  • Submitted: 1997-10-15
  • Updated: 1999-01-15
  • Resolved: 1999-01-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.2.0 1.2beta4Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Description
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);
    }


Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: generic FIXED IN: 1.2beta4 INTEGRATED IN: 1.2beta4
14-06-2004

PUBLIC COMMENTS 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); }
10-06-2004

EVALUATION When an exception is thrown because another exception is thrown (ExceptionInInitialzerError, InvocationTargetException) we really should show both stack traces. anand.palaniswamy@Eng 1998-02-06
06-02-1998