Package java.lang.reflect
Class InvocationTargetException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.ReflectiveOperationException
-
- java.lang.reflect.InvocationTargetException
-
- All Implemented Interfaces:
Serializable
public class InvocationTargetException extends ReflectiveOperationException
This class provides a wrapper for an exception thrown by aMethodorConstructorinvocation.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedInvocationTargetException()Constructs a newInvocationTargetExceptioninstance with anullcause / target exception.InvocationTargetException(Throwable exception)Constructs a newInvocationTargetExceptioninstance with its cause / target exception filled in.InvocationTargetException(Throwable exception, String detailMessage)Constructs a newInvocationTargetExceptioninstance with its cause / target exception and message filled in.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ThrowablegetCause()Returns the cause of this exception, which may benull.ThrowablegetTargetException()Returns the target exception, which may benull.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
InvocationTargetException
protected InvocationTargetException()
Constructs a newInvocationTargetExceptioninstance with anullcause / target exception.
-
InvocationTargetException
public InvocationTargetException(Throwable exception)
Constructs a newInvocationTargetExceptioninstance with its cause / target exception filled in.- Parameters:
exception- the exception which occurred while running the Method or Constructor
-
InvocationTargetException
public InvocationTargetException(Throwable exception, String detailMessage)
Constructs a newInvocationTargetExceptioninstance with its cause / target exception and message filled in.- Parameters:
detailMessage- the detail message for the exceptionexception- the exception which occurred while running the Method or Constructor
-
-
Method Detail
-
getTargetException
public Throwable getTargetException()
Returns the target exception, which may benull.- Returns:
- the target exception
-
-