java.lang.reflect
Class InvocationTargetException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byjava.lang.reflect.InvocationTargetException
All Implemented Interfaces:
Serializable

public class InvocationTargetException
extends Exception

This class provides a wrapper for an exception thrown by a Method or Constructor invocation.

See Also:
Method.invoke(java.lang.Object, java.lang.Object[]), Constructor.newInstance(java.lang.Object[]), Serialized Form

Constructor Summary
InvocationTargetException(Throwable exception)
          Constructs a new instance of this class with its walkback and target exception filled in.
InvocationTargetException(Throwable exception, java.lang.String detailMessage)
          Constructs a new instance of this class with its walkback, target exception and message filled in.
 
Method Summary
 Throwable getCause()
          Answers the cause of this Throwable, or null if there is no cause.
 Throwable getTargetException()
          Answers the exception which caused the receiver to be thrown.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InvocationTargetException

public InvocationTargetException(Throwable exception)
Constructs a new instance of this class with its walkback and target exception filled in.

Parameters:
exception - Throwable The exception which occurred while running the Method or Constructor.

InvocationTargetException

public InvocationTargetException(Throwable exception,
                                 java.lang.String detailMessage)
Constructs a new instance of this class with its walkback, target exception and message filled in.

Parameters:
detailMessage - String The detail message for the exception.
exception - Throwable The exception which occurred while running the Method or Constructor.
Method Detail

getTargetException

public Throwable getTargetException()
Answers the exception which caused the receiver to be thrown.


getCause

public Throwable getCause()
Answers the cause of this Throwable, or null if there is no cause.

Overrides:
getCause in class Throwable
Returns:
Throwable The receiver's cause.