public class UndeclaredThrowableException extends RuntimeException
invoke方法抛出一个异常(一
Throwable,不能分配给
RuntimeException或
Error),不能分配给任何的异常类型声明,在代理实例调用方法的
throws条款和派遣来调用处理程序。
一个UndeclaredThrowableException实例包含未检查的异常被抛出的调用处理程序,它可以与getUndeclaredThrowable()方法检索。UndeclaredThrowableException延伸RuntimeException,所以它是一个unchecked异常,把被检查的异常。
在1.4版本中,该异常已被更新以符合通用异常链机制。“未检查的异常,被调用处理程序”,可以在施工时提供的并经getUndeclaredThrowable()方法访问现在被称为零原因,可通过Throwable.getCause()方法访问,以及前述的“传统方法”。
InvocationHandler,
Serialized Form
| Constructor and Description |
|---|
UndeclaredThrowableException(Throwable undeclaredThrowable)
构建一个具有指定
Throwable
UndeclaredThrowableException。
|
UndeclaredThrowableException(Throwable undeclaredThrowable, String s)
构建与指定的
Throwable和详细信息的一个
UndeclaredThrowableException。
|
| Modifier and Type | Method and Description |
|---|---|
Throwable |
getCause()
返回该异常的原因(这
Throwable实例包裹在这
UndeclaredThrowableException,可
null)。
|
Throwable |
getUndeclaredThrowable()
返回
Throwable实例包裹在这
UndeclaredThrowableException,可
null。
|
addSuppressed, fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringpublic UndeclaredThrowableException(Throwable undeclaredThrowable)
Throwable
UndeclaredThrowableException。
undeclaredThrowable的未检查的异常被抛出
public Throwable getUndeclaredThrowable()
Throwable实例包裹在这
UndeclaredThrowableException,可
null。
这种方法在通用异常链设施。现在的Throwable.getCause()方法获取这一信息的首选方式。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.