java.lang
Class ExceptionInInitializerError

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.lang.Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable 
      extended by java.lang.Error sample code for java.lang.Error definition code for java.lang.Error 
          extended by java.lang.LinkageError sample code for java.lang.LinkageError definition code for java.lang.LinkageError 
              extended by java.lang.ExceptionInInitializerError
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable

public class ExceptionInInitializerError
extends LinkageError sample code for java.lang.LinkageError definition code for java.lang.LinkageError

Signals that an unexpected exception has occurred in a static initializer. An ExceptionInInitializerError is thrown to indicate that an exception occurred during evaluation of a static initializer or the initializer for a static variable.

As of release 1.4, this exception has been retrofitted to conform to the general purpose exception-chaining mechanism. The "saved throwable object" that may be provided at construction time and accessed via the getException() sample code for java.lang.ExceptionInInitializerError.getException() definition code for java.lang.ExceptionInInitializerError.getException() method is now known as the cause, and may be accessed via the Throwable.getCause() sample code for java.lang.Throwable.getCause() definition code for java.lang.Throwable.getCause() method, as well as the aforementioned "legacy method."

Since:
JDK1.1
See Also:
Serialized Form

Constructor Summary
ExceptionInInitializerError sample code for java.lang.ExceptionInInitializerError.ExceptionInInitializerError() definition code for java.lang.ExceptionInInitializerError.ExceptionInInitializerError() ()
          Constructs an ExceptionInInitializerError with null as its detail message string and with no saved throwable object.
ExceptionInInitializerError sample code for java.lang.ExceptionInInitializerError.ExceptionInInitializerError(java.lang.String) definition code for java.lang.ExceptionInInitializerError.ExceptionInInitializerError(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  s)
          Constructs an ExceptionInInitializerError with the specified detail message string.
ExceptionInInitializerError sample code for java.lang.ExceptionInInitializerError.ExceptionInInitializerError(java.lang.Throwable) definition code for java.lang.ExceptionInInitializerError.ExceptionInInitializerError(java.lang.Throwable) (Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable  thrown)
          Constructs a new ExceptionInInitializerError class by saving a reference to the Throwable object thrown for later retrieval by the getException() sample code for java.lang.ExceptionInInitializerError.getException() definition code for java.lang.ExceptionInInitializerError.getException() method.
 
Method Summary
 Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable getCause sample code for java.lang.ExceptionInInitializerError.getCause() definition code for java.lang.ExceptionInInitializerError.getCause() ()
          Returns the cause of this error (the exception that occurred during a static initialization that caused this error to be created).
 Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable getException sample code for java.lang.ExceptionInInitializerError.getException() definition code for java.lang.ExceptionInInitializerError.getException() ()
          Returns the exception that occurred during a static initialization that caused this error to be created.
 
Methods inherited from class java.lang.Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable
fillInStackTrace sample code for java.lang.Throwable.fillInStackTrace() definition code for java.lang.Throwable.fillInStackTrace() , getLocalizedMessage sample code for java.lang.Throwable.getLocalizedMessage() definition code for java.lang.Throwable.getLocalizedMessage() , getMessage sample code for java.lang.Throwable.getMessage() definition code for java.lang.Throwable.getMessage() , getStackTrace sample code for java.lang.Throwable.getStackTrace() definition code for java.lang.Throwable.getStackTrace() , initCause sample code for java.lang.Throwable.initCause(java.lang.Throwable) definition code for java.lang.Throwable.initCause(java.lang.Throwable) , printStackTrace sample code for java.lang.Throwable.printStackTrace() definition code for java.lang.Throwable.printStackTrace() , printStackTrace sample code for java.lang.Throwable.printStackTrace(java.io.PrintStream) definition code for java.lang.Throwable.printStackTrace(java.io.PrintStream) , printStackTrace sample code for java.lang.Throwable.printStackTrace(java.io.PrintWriter) definition code for java.lang.Throwable.printStackTrace(java.io.PrintWriter) , setStackTrace sample code for java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[]) definition code for java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[]) , toString sample code for java.lang.Throwable.toString() definition code for java.lang.Throwable.toString()
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

ExceptionInInitializerError sample code for java.lang.ExceptionInInitializerError() definition code for java.lang.ExceptionInInitializerError()

public ExceptionInInitializerError()
Constructs an ExceptionInInitializerError with null as its detail message string and with no saved throwable object. A detail message is a String that describes this particular exception.


ExceptionInInitializerError sample code for java.lang.ExceptionInInitializerError(java.lang.Throwable) definition code for java.lang.ExceptionInInitializerError(java.lang.Throwable)

public ExceptionInInitializerError(Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable  thrown)
Constructs a new ExceptionInInitializerError class by saving a reference to the Throwable object thrown for later retrieval by the getException() sample code for java.lang.ExceptionInInitializerError.getException() definition code for java.lang.ExceptionInInitializerError.getException() method. The detail message string is set to null.

Parameters:
thrown - The exception thrown

ExceptionInInitializerError sample code for java.lang.ExceptionInInitializerError(java.lang.String) definition code for java.lang.ExceptionInInitializerError(java.lang.String)

public ExceptionInInitializerError(String sample code for java.lang.String definition code for java.lang.String  s)
Constructs an ExceptionInInitializerError with the specified detail message string. A detail message is a String that describes this particular exception. The detail message string is saved for later retrieval by the Throwable.getMessage() sample code for java.lang.Throwable.getMessage() definition code for java.lang.Throwable.getMessage() method. There is no saved throwable object.

Parameters:
s - the detail message
Method Detail

getException sample code for java.lang.ExceptionInInitializerError.getException() definition code for java.lang.ExceptionInInitializerError.getException()

public Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable  getException()
Returns the exception that occurred during a static initialization that caused this error to be created.

This method predates the general-purpose exception chaining facility. The Throwable.getCause() sample code for java.lang.Throwable.getCause() definition code for java.lang.Throwable.getCause() method is now the preferred means of obtaining this information.

Returns:
the saved throwable object of this ExceptionInInitializerError, or null if this ExceptionInInitializerError has no saved throwable object.

getCause sample code for java.lang.ExceptionInInitializerError.getCause() definition code for java.lang.ExceptionInInitializerError.getCause()

public Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable  getCause()
Returns the cause of this error (the exception that occurred during a static initialization that caused this error to be created).

Overrides:
getCause sample code for java.lang.Throwable.getCause() definition code for java.lang.Throwable.getCause() in class Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable
Returns:
the cause of this error or null if the cause is nonexistent or unknown.
Since:
1.4