public class PrivilegedActionException extends 异常
doPrivileged(PrivilegedExceptionAction)和doPrivileged(PrivilegedExceptionAction, AccessControlContext context)抛出,表示正在执行的动作抛出一个被检查的异常。
可以通过调用getException方法获取操作抛出的异常。
实际上, PrivilegedActionException是特权操作抛出的异常的“包装器”。
从版本1.4开始,这种异常已被改进以符合通用异常链接机制。 在建造时提供的“通过特权计算抛出的异常”是通过getException()方法访问的,现在被称为原因 ,并且可以通过Throwable.getCause()方法以及上述“传统方法”来访问。
| Constructor and Description |
|---|
PrivilegedActionException(异常 exception)
构造一个新的PrivilegedActionException“包装”特定的异常。
|
| Modifier and Type | Method and Description |
|---|---|
Throwable |
getCause()
返回此异常(由导致该特权计算抛出的异常的原因
PrivilegedActionException )。
|
异常 |
getException()
返回导致此
PrivilegedActionException的特权计算抛出的异常。
|
String |
toString()
返回此可抛出的简短描述。
|
addSuppressed, fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTracepublic PrivilegedActionException(异常 exception)
exception - 抛出的异常
public 异常 getException()
PrivilegedActionException的特权计算抛出的异常。
这种方法早于通用异常链接工具。 Throwable.getCause()方法现在是获取此信息的首选方法。
PrivilegedActionException 。
PrivilegedExceptionAction , AccessController.doPrivileged(PrivilegedExceptionAction) , AccessController.doPrivileged(PrivilegedExceptionAction, AccessControlContext)
public Throwable getCause()
PrivilegedActionException )。
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.