public class java.lang.reflect
InvocationTargetException


Show All Login
Java SE 6
  
Extends: Throwable > Exception
Details
InvocationTargetException is a checked exception that wraps an exception thrown by an invoked method or constructor.

As of release 1.4, this exception has been retrofitted to conform to the general purpose exception-chaining mechanism. The "target exception" that is provided at construction time and accessed via the #getTargetException() method is now known as the cause, and may be accessed via the Throwable#getCause() method, as well as the aforementioned "legacy method."
See also java.lang.reflect.Method, java.lang.reflect.Constructor


Constructors
protected InvocationTargetException()
Constructs an InvocationTargetException with null as the target exception.
public InvocationTargetException(Throwable target) Details
Constructs a InvocationTargetException with a target exception.
targetthe target exception
public InvocationTargetException(Throwable target, String s) Details
Constructs a InvocationTargetException with a target exception and a detail message.
targetthe target exception
sthe detail message

Properties
public Throwable getCause() Details
Returns the cause of this exception (the thrown target exception, which may be null).
returnthe cause of this exception.
since1.4
public Throwable getTargetException() Details
Get the thrown target exception.

This method predates the general-purpose exception chaining facility. The Throwable#getCause() method is now the preferred means of obtaining this information.
returnthe thrown target exception (cause of this exception).