Class InvocationTargetException

All Implemented Interfaces:
Serializable

public class InvocationTargetException
extends ReflectiveOperationException
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 Details

    • InvocationTargetException

      protected InvocationTargetException()
      Constructs a new InvocationTargetException instance with a null cause / target exception.
    • InvocationTargetException

      public InvocationTargetException​(Throwable exception)
      Constructs a new InvocationTargetException instance 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 new InvocationTargetException instance with its cause / target exception and message filled in.
      Parameters:
      detailMessage - the detail message for the exception
      exception - the exception which occurred while running the Method or Constructor
  • Method Details

    • getTargetException

      public Throwable getTargetException()
      Returns the target exception, which may be null.
      Returns:
      the target exception
    • getCause

      public Throwable getCause()
      Returns the cause of this exception, which may be null.
      Overrides:
      getCause in class Throwable
      Returns:
      the cause of this exception