[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] FYI: gnu.java.security.action tweaks
From: |
Bryce McKinlay |
Subject: |
[cp-patches] FYI: gnu.java.security.action tweaks |
Date: |
Wed, 28 Jul 2004 18:31:47 -0400 |
User-agent: |
Mozilla Thunderbird 0.5 (X11/20040626) |
This patch adds support for default property values in
GetPropertyAction, and fixes a couple of spelling typos in the Javadoc
for SetAccessibleAction.
I'm checking it in.
Bryce
2004-07-28 Bryce McKinlay <address@hidden>
* gnu/java/security/action/GetPropertyAction.java (setParameters):
Renamed from 'setName'. New 2-argument form with default value.
(run): Pass default 'value' parameter to System.getProperty().
* gnu/java/security/action/SetAccessibleAction.java: Fix javadoc
typos.
* gnu/java/net/protocol/http/Connection.java: Use 'setParameters'
not 'setName'.
Index: gnu/java/net/protocol/http/Connection.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/net/protocol/http/Connection.java,v
retrieving revision 1.18
diff -u -r1.18 Connection.java
--- gnu/java/net/protocol/http/Connection.java 23 Jul 2004 22:20:14 -0000
1.18
+++ gnu/java/net/protocol/http/Connection.java 28 Jul 2004 22:26:15 -0000
@@ -97,7 +97,7 @@
if (proxyHost != null)
{
proxyInUse = true;
- getProperty.setName("http.proxyPort");
+ getProperty.setParameters("http.proxyPort");
port = (String) AccessController.doPrivileged(getProperty);
if (port != null)
{
@@ -112,7 +112,7 @@
}
}
- getProperty.setName("http.agent");
+ getProperty.setParameters("http.agent");
userAgent = (String) AccessController.doPrivileged(getProperty);
}
Index: gnu/java/security/action/GetPropertyAction.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/security/action/GetPropertyAction.java,v
retrieving revision 1.1
diff -u -r1.1 GetPropertyAction.java
--- gnu/java/security/action/GetPropertyAction.java 23 Jul 2004 22:20:14
-0000 1.1
+++ gnu/java/security/action/GetPropertyAction.java 28 Jul 2004 22:26:15
-0000
@@ -51,7 +51,8 @@
*/
public class GetPropertyAction implements PrivilegedAction
{
- String propName;
+ String name;
+ String value = null;
public GetPropertyAction()
{
@@ -59,17 +60,30 @@
public GetPropertyAction(String propName)
{
- this.propName = propName;
+ setParameters(propName);
+ }
+
+ public GetPropertyAction(String propName, String defaultValue)
+ {
+ setParameters(propName, defaultValue);
}
public Object run()
{
- return System.getProperty(propName);
+ return System.getProperty(name, value);
}
- public GetPropertyAction setName(String propName)
+ public GetPropertyAction setParameters(String propName)
+ {
+ this.name = propName;
+ this.value = null;
+ return this;
+ }
+
+ public GetPropertyAction setParameters(String propName, String defaultValue)
{
- this.propName = propName;
+ this.name = propName;
+ this.value = defaultValue;
return this;
}
}
Index: gnu/java/security/action/SetAccessibleAction.java
===================================================================
RCS file:
/cvs/gcc/gcc/libjava/gnu/java/security/action/SetAccessibleAction.java,v
retrieving revision 1.1
diff -u -r1.1 SetAccessibleAction.java
--- gnu/java/security/action/SetAccessibleAction.java 23 Jul 2004 22:20:14
-0000 1.1
+++ gnu/java/security/action/SetAccessibleAction.java 28 Jul 2004 22:26:15
-0000
@@ -41,13 +41,13 @@
import java.security.PrivilegedAction;
/**
- * PrivilagedAction implementation that calls setAccessible(true) on the
+ * PrivilegedAction implementation that calls setAccessible(true) on the
* AccessibleObject passed to its constructor.
*
* Example of use:
* <code>
* Field dataField = cl.getDeclaredField("data");
- * AccessController.doPrivilaged(new SetAccessibleAction(dataField));
+ * AccessController.doPrivileged(new SetAccessibleAction(dataField));
* </code>
*/
public class SetAccessibleAction implements PrivilegedAction
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] FYI: gnu.java.security.action tweaks,
Bryce McKinlay <=