2005-04-26 Jeroen Frijters <jeroen@frijters.net>
* gnu/java/security/action/GetSecurityPropertyAction.java (GetSecurityPropertyAction): Implement PrivilegedAction instead of extending GetPropertyAction. (name): New field. (value): Likewise. (setParamters): New methods. (GetSecurityPropertyAction): Use new setParameters methods. From-SVN: r98765
This commit is contained in:
parent
a79f940af0
commit
6f3a3283f2
2 changed files with 32 additions and 5 deletions
|
@ -50,25 +50,42 @@ import java.security.Security;
|
|||
* String passwd = AccessController.doPrivileged(action);
|
||||
* </code>
|
||||
*/
|
||||
public class GetSecurityPropertyAction extends GetPropertyAction
|
||||
public class GetSecurityPropertyAction implements PrivilegedAction
|
||||
{
|
||||
private String name;
|
||||
private String value;
|
||||
|
||||
public GetSecurityPropertyAction()
|
||||
{
|
||||
}
|
||||
|
||||
public GetSecurityPropertyAction (String propName)
|
||||
public GetSecurityPropertyAction(String propName)
|
||||
{
|
||||
super (propName);
|
||||
setParameters(propName);
|
||||
}
|
||||
|
||||
public GetSecurityPropertyAction(String propName, String defaultValue)
|
||||
{
|
||||
super (propName, defaultValue);
|
||||
setParameters(propName, defaultValue);
|
||||
}
|
||||
|
||||
public GetSecurityPropertyAction setParameters(String propName)
|
||||
{
|
||||
this.name = propName;
|
||||
this.value = null;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetSecurityPropertyAction setParameters(String propName, String defaultValue)
|
||||
{
|
||||
this.name = propName;
|
||||
this.value = defaultValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Object run()
|
||||
{
|
||||
String val = Security.getProperty (name);
|
||||
String val = Security.getProperty(name);
|
||||
if (val == null)
|
||||
val = value;
|
||||
return val;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue