Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.lang

Class ExceptionInInitializerError

java.lang.Object
|
+--java.lang.Throwable
   |
   +--java.lang.Error
      |
      +--java.lang.LinkageError
         |
         +--java.lang.ExceptionInInitializerError


public class ExceptionInInitializerError

extends LinkageError

An ExceptionInInitializerError is thrown when an uncaught exception has occurred in a static initializer or the initializer for a static variable. In general, this wraps only RuntimeExceptions, since the compiler does not allow a checked exception to be uncaught in an initializer. This exception only occurs during reflection, when a class is initialized as part of another action.

Since:Authors:

Constructor Summary

ExceptionInInitializerError()

Create an error without a message.
ExceptionInInitializerError(java.lang.String s)

Create an error with a message.
ExceptionInInitializerError(java.lang.Throwable t)

Creates an error an saves a reference to the Throwable object.

Method Summary

java.lang.ThrowablegetCause()

Return the exception that cause this error to be created.
java.lang.ThrowablegetException()

Return the exception that caused this error to be created.

Constructor Details

ExceptionInInitializerError

public ExceptionInInitializerError()

Create an error without a message. The cause is initialized as null.


ExceptionInInitializerError

public ExceptionInInitializerError(java.lang.String s)

Create an error with a message. The cause is initialized as null.

Parameters:


ExceptionInInitializerError

public ExceptionInInitializerError(java.lang.Throwable t)

Creates an error an saves a reference to the Throwable object. The message string is null.

Parameters:


Method Details

getCause

public Throwable getCause()

Return the exception that cause this error to be created.

Since:Returns:


getException

public Throwable getException()

Return the exception that caused this error to be created. This is a legacy method; the preferred choice now is Throwable#getCause().

Returns: