An instance of this class can be used as the argument of
AccessController.doPrivileged
.
The following code retrieves the boolean value of the system
property named "prop"
as a privileged action:
boolean b = java.security.AccessController.doPrivileged (new GetBooleanAction("prop")).booleanValue();
java.security.PrivilegedAction
, java.security.AccessController
Access | Constructor and Description |
---|---|
public | GetBooleanAction(String
the name of the system property. theProp)Constructor that takes the name of the system property whose boolean value needs to be determined. |
Modifier and Type | Method and Description |
---|---|
public static boolean | privilegedGetProperty(String
the name of the system property. theProp)Convenience method to get a property without going through doPrivileged if no security manager is present. |
public Boolean | Returns: theBoolean value of the system property.Implements java. Determines the boolean value of the system property whose name was specified in the constructor. |
theProp | back to summary |
---|---|
private final String theProp |
GetBooleanAction | back to summary |
---|---|
public GetBooleanAction(String theProp) Constructor that takes the name of the system property whose boolean value needs to be determined.
|
privilegedGetProperty | back to summary |
---|---|
public static boolean privilegedGetProperty(String theProp) Convenience method to get a property without going through doPrivileged if no security manager is present. This is unsafe for inclusion in a public API but allowable here since this class is now encapsulated. Note that this method performs a privileged action using caller-provided inputs. The caller of this method should take care to ensure that the inputs are not tainted and the returned property is not made accessible to untrusted code if it contains sensitive information.
|
run | back to summary |
---|---|
public Boolean run() Implements java. Determines the boolean value of the system property whose name was specified in the constructor.
|