Most visited

Recently visited

Added in API level 1

UndeclaredThrowableException

public class UndeclaredThrowableException
extends RuntimeException

java.lang.Object
    java.lang.Throwable
      java.lang.Exception
        java.lang.RuntimeException
          java.lang.reflect.UndeclaredThrowableException


如果其调用处理程序的方法调用 invoke方法抛出一个检查异常( Throwable不可分配给 RuntimeExceptionError ),而该分配不能分配给方法的 throws子句中声明的任何异常类型, throws代理实例上的方法调用抛出在代理实例上调用并分派给调用处理程序。

一个UndeclaredThrowableException实例包含调用处理程序抛出的未声明的已检查异常,并且可以使用getUndeclaredThrowable()方法检索它。 UndeclaredThrowableException扩展了RuntimeException ,所以它是一个未检查的异常,它包装了一个检查的异常。

从版本1.4开始,此异常已进行了改进,以符合通用异常链接机制。 现在可以在施工时提供并通过getUndeclaredThrowable()方法访问的“调用处理程序抛出的未声明的已检查异常”现在称为原因 ,可以通过getCause()方法以及上述“传统方法“。

也可以看看:

摘要(Summary)

Public constructors

UndeclaredThrowableException(Throwable undeclaredThrowable)

构造一个 UndeclaredThrowableException使用指定 Throwable

UndeclaredThrowableException(Throwable undeclaredThrowable, String s)

使用指定的 Throwable和详细消息构造一个 UndeclaredThrowableException

公共方法(Public methods)

Throwable getCause()

返回此异常的原因(包含在此 UndeclaredThrowableExceptionThrowable实例,可能为 null )。

Throwable getUndeclaredThrowable()

返回 Throwable实例包裹在这个 UndeclaredThrowableException ,这可能是 null

继承方法(Inherited methods)

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

Public constructors

UndeclaredThrowableException

Added in API level 1
UndeclaredThrowableException (Throwable undeclaredThrowable)

构造一个 UndeclaredThrowableException使用指定 Throwable

参数(Parameters)
undeclaredThrowable Throwable: the undeclared checked exception that was thrown

UndeclaredThrowableException

Added in API level 1
UndeclaredThrowableException (Throwable undeclaredThrowable, 
                String s)

使用指定的 Throwable和详细消息构造一个 UndeclaredThrowableException

参数(Parameters)
undeclaredThrowable Throwable: the undeclared checked exception that was thrown
s String: the detail message

公共方法(Public methods)

getCause

Added in API level 1
Throwable getCause ()

返回此异常(的原因 Throwable实例包裹在此 UndeclaredThrowableException ,其可以是 null )。

返回(Returns)
Throwable the cause of this exception.

getUndeclaredThrowable

Added in API level 1
Throwable getUndeclaredThrowable ()

返回 Throwable实例包裹在这个 UndeclaredThrowableException ,这可能是 null

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

返回(Returns)
Throwable the undeclared checked exception that was thrown

Hooray!