Most visited

Recently visited

Added in API level 1

InvocationTargetException

public class InvocationTargetException
extends ReflectiveOperationException

java.lang.Object
   ↳ java.lang.Throwable
     ↳ java.lang.Exception
       ↳ java.lang.ReflectiveOperationException
         ↳ java.lang.reflect.InvocationTargetException


InvocationTargetException是一个检查的异常,它包装由调用的方法或构造函数抛出的异常。

从版本1.4开始,此异常已进行了改进,以符合通用异常链接机制。 在施工时提供并通过getTargetException()方法访问的“目标例外”现在被称为原因 ,并且可以通过getCause()方法以及上述“遗留方法”访问。

也可以看看:

Summary

Public constructors

InvocationTargetException(Throwable target)

用目标异常构造一个InvocationTargetException。

InvocationTargetException(Throwable target, String s)

用目标异常和详细消息构造一个InvocationTargetException。

Protected constructors

InvocationTargetException()

用 null构造一个 InvocationTargetException作为目标异常。

Public methods

Throwable getCause()

返回此异常的原因(抛出的目标异常,可能是 null )。

Throwable getTargetException()

获取抛出的目标异常。

Inherited methods

From class java.lang.Throwable
From class java.lang.Object

Public constructors

InvocationTargetException

Added in API level 1
InvocationTargetException (Throwable target)

用目标异常构造一个InvocationTargetException。

Parameters
target Throwable: the target exception

InvocationTargetException

Added in API level 1
InvocationTargetException (Throwable target, 
                String s)

用目标异常和详细消息构造一个InvocationTargetException。

Parameters
target Throwable: the target exception
s String: the detail message

Protected constructors

InvocationTargetException

Added in API level 1
InvocationTargetException ()

用 null构造一个 InvocationTargetException作为目标异常。

Public methods

getCause

Added in API level 1
Throwable getCause ()

返回此异常的原因(抛出的目标异常,可能是 null )。

Returns
Throwable the cause of this exception.

getTargetException

Added in API level 1
Throwable getTargetException ()

获取抛出的目标异常。

该方法早于通用异常链接设施。 getCause()方法现在是获取此信息的首选方法。

Returns
Throwable the thrown target exception (cause of this exception).

Hooray!