Stay organized with collections
Save and categorize content based on your preferences.
PrivilegedActionException
open class PrivilegedActionException : Exception
Legacy security code; do not use. This exception is thrown by doPrivileged(PrivilegedExceptionAction)
and doPrivileged(PrivilegedExceptionAction, AccessControlContext context)
to indicate that the action being performed threw a checked exception. The exception thrown by the action can be obtained by calling the getException
method. In effect, an PrivilegedActionException
is a "wrapper" for an exception thrown by a privileged action.
As of release 1.4, this exception has been retrofitted to conform to the general purpose exception-chaining mechanism. The "exception thrown by the privileged computation" that is provided at construction time and accessed via the getException()
method is now known as the cause, and may be accessed via the Throwable.getCause()
method, as well as the aforementioned "legacy method."
Summary
Public constructors |
Constructs a new PrivilegedActionException "wrapping" the specific Exception.
|
Public methods |
open Exception! |
Returns the exception thrown by the privileged computation that resulted in this PrivilegedActionException .
|
open String |
|
Properties |
open Throwable? |
Returns the cause of this exception (the exception thrown by the privileged computation that resulted in this PrivilegedActionException ).
|
Public constructors
PrivilegedActionException
PrivilegedActionException(exception: Exception!)
Constructs a new PrivilegedActionException "wrapping" the specific Exception.
Parameters |
exception |
Exception!: The exception thrown |
Public methods
getException
open fun getException(): Exception!
Returns the exception thrown by the privileged computation that resulted in this PrivilegedActionException
.
This method predates the general-purpose exception chaining facility. The Throwable.getCause()
method is now the preferred means of obtaining this information.
Return |
Exception! |
the exception thrown by the privileged computation that resulted in this PrivilegedActionException . |
toString
open fun toString(): String
Return |
String |
a string representation of this throwable. |
Properties
cause
open val cause: Throwable?
Returns the cause of this exception (the exception thrown by the privileged computation that resulted in this PrivilegedActionException
).
Return |
Throwable? |
the cause of this exception. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# PrivilegedActionException\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nPrivilegedActionException\n=========================\n\n```\nopen class PrivilegedActionException : Exception\n```\n\n|---|---|---|----------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||||\n| ↳ | [kotlin.Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html) |||\n| | ↳ | [java.lang.Exception](../lang/Exception.html#) ||\n| | | ↳ | [java.security.PrivilegedActionException](#) |\n\nLegacy security code; do not use. This exception is thrown by `doPrivileged(PrivilegedExceptionAction)` and `doPrivileged(PrivilegedExceptionAction, AccessControlContext context)` to indicate that the action being performed threw a checked exception. The exception thrown by the action can be obtained by calling the `getException` method. In effect, an `PrivilegedActionException` is a \"wrapper\" for an exception thrown by a privileged action.\n\nAs of release 1.4, this exception has been retrofitted to conform to the general purpose exception-chaining mechanism. The \"exception thrown by the privileged computation\" that is provided at construction time and accessed via the [getException()](#getException()) method is now known as the *cause* , and may be accessed via the [Throwable.getCause()](../lang/Throwable.html#getCause()) method, as well as the aforementioned \"legacy method.\"\n\nSummary\n-------\n\n| Public constructors ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [PrivilegedActionException](#PrivilegedActionException(java.lang.Exception))`(`exception:` `[Exception](../lang/Exception.html#)!`)` Constructs a new PrivilegedActionException \"wrapping\" the specific Exception. |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Exception](../lang/Exception.html#)! | [getException](#getException())`()` Returns the exception thrown by the privileged computation that resulted in this `PrivilegedActionException`. |\n| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [toString](#toString())`()` \u003cbr /\u003e |\n\n| Properties ||\n|----------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)? | [cause](#cause:kotlin.Throwable) Returns the cause of this exception (the exception thrown by the privileged computation that resulted in this `PrivilegedActionException`). |\n\nPublic constructors\n-------------------\n\n### PrivilegedActionException\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nPrivilegedActionException(exception: Exception!)\n```\n\nConstructs a new PrivilegedActionException \"wrapping\" the specific Exception.\n\n| Parameters ||\n|-------------|-------------------------------------------------------------|\n| `exception` | [Exception](../lang/Exception.html#)!: The exception thrown |\n\nPublic methods\n--------------\n\n### getException\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getException(): Exception!\n```\n\nReturns the exception thrown by the privileged computation that resulted in this `PrivilegedActionException`.\n\nThis method predates the general-purpose exception chaining facility. The [Throwable.getCause()](../lang/Throwable.html#getCause()) method is now the preferred means of obtaining this information.\n\n| Return ||\n|---------------------------------------|-------------------------------------------------------------------------------------------------------|\n| [Exception](../lang/Exception.html#)! | the exception thrown by the privileged computation that resulted in this `PrivilegedActionException`. |\n\n**See Also**\n\n- [java.security.PrivilegedExceptionAction](/reference/kotlin/java/security/PrivilegedExceptionAction)\n- [java.security.AccessController#doPrivileged(PrivilegedExceptionAction)](/reference/kotlin/java/security/AccessController#doPrivileged(java.security.PrivilegedExceptionAction))\n- [java.security.AccessController#doPrivileged(PrivilegedExceptionAction,\n* AccessControlContext)](/reference/kotlin/java/security/AccessController#doPrivileged(java.security.PrivilegedExceptionAction,%20java.security.AccessControlContext)) \n\n### toString\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun toString(): String\n```\n\n| Return ||\n|----------------------------------------------------------------------------------|--------------------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | a string representation of this throwable. |\n\nProperties\n----------\n\n### cause\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen val cause: Throwable?\n```\n\nReturns the cause of this exception (the exception thrown by the privileged computation that resulted in this `PrivilegedActionException`).\n\n| Return ||\n|-----------------------------------------------------------------------------------------|------------------------------|\n| [Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)? | the cause of this exception. |"]]