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, setStackTrace
public 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.