ExceptionInInitializerError

Archie Cobbs archie at whistle.com
Tue Jul 11 11:45:33 PDT 2000


Godmar Back writes:
>  Call ExceptionInInitializerError.getException() first and then print the
> stacktrace.
> 
> > How does Kaffe fill in the stack trace for the exception wrapped in an
> > ExceptionInInitializerError? I had hoped that it would tell me the line
> > number within the initializer where the exception occured but the stack
> > trace only shows the stack up to the method that caused that class to be
> > processed (for example, Constructor.newInstance() or Class.forName()).
> > 
> > Can anyone suggest a simple solution, or refer me to the appropriate
> > place in the source code?

I think there still is a problem... eg.:

  $ cat > x.java
  public class x {
      static {
	  ((Object)null).hashCode();
      }
  }
  $ jikes x.java
  $ kaffe x
  java.lang.ExceptionInInitializerError: [exception was java.lang.NullPointerException]
	  at java.lang.Class.forName(Class.java:native)
	  at java.lang.Class.forName(Class.java:52)
  java.lang.NullPointerException
	  at java.lang.Class.forName(Class.java:native)
	  at java.lang.Class.forName(Class.java:52)

Note that the NullPointerException has the wrong stack trace..

-Archie

___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com


More information about the kaffe mailing list