Top Description Fields Constructors Methods
java.lang.reflect

public Class InvocationTargetException

extends ReflectiveOperationException
Class Inheritance

InvocationTargetException is a checked exception that wraps an exception thrown by an invoked method or constructor.
Since
1.1
See Also
Method, Constructor

Field Summary

Modifier and TypeField and Description
private static final long
serialVersionUID

Hides java.lang.ReflectiveOperationException.serialVersionUID.

Use serialVersionUID from JDK 1.1.X for interoperability
private final Throwable
target

This field holds the target if the InvocationTargetException(Throwable target) constructor was used to instantiate the object

Constructor Summary

AccessConstructor and Description
protected
InvocationTargetException()

Constructs an InvocationTargetException with null as the target exception.

public
InvocationTargetException(Throwable
the target exception
target
)

Constructs a InvocationTargetException with a target exception.

public
InvocationTargetException(Throwable
the target exception
target
,
String
the detail message
s
)

Constructs a InvocationTargetException with a target exception and a detail message.

Method Summary

Modifier and TypeMethod and Description
public Throwable

Returns:

the cause of this exception.
getCause
()

Overrides java.lang.Throwable.getCause.

Returns the cause of this exception (the thrown target exception, which may be null).

public Throwable

Returns:

the thrown target exception (cause of this exception).
getTargetException
()

Get the thrown target exception.

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.ReflectiveOperationException.serialVersionUID.

Use serialVersionUID from JDK 1.1.X for interoperability

Annotations
@Serial
targetback to summary
private final Throwable target

This field holds the target if the InvocationTargetException(Throwable target) constructor was used to instantiate the object

Constructor Detail

InvocationTargetExceptionback to summary
protected InvocationTargetException()

Constructs an InvocationTargetException with null as the target exception.

InvocationTargetExceptionback to summary
public InvocationTargetException(Throwable target)

Constructs a InvocationTargetException with a target exception.

Parameters
target:Throwable

the target exception

InvocationTargetExceptionback to summary
public InvocationTargetException(Throwable target, String s)

Constructs a InvocationTargetException with a target exception and a detail message.

Parameters
target:Throwable

the target exception

s:String

the detail message

Method Detail

getCauseback to summary
public Throwable getCause()

Overrides java.lang.Throwable.getCause.

Returns the cause of this exception (the thrown target exception, which may be null).

Returns:Throwable

the cause of this exception.

Annotations
@Override
Since
1.4
getTargetExceptionback to summary
public Throwable getTargetException()

Get the thrown target exception.

API Note

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

Returns:Throwable

the thrown target exception (cause of this exception).