summaryrefslogtreecommitdiff
path: root/gnu/java/net
diff options
context:
space:
mode:
authorBryce McKinlay <mckinlay@redhat.com>2004-07-28 22:32:30 +0000
committerBryce McKinlay <mckinlay@redhat.com>2004-07-28 22:32:30 +0000
commit39f4e18fc9d6769a1d5a3bb0f542fdcf77b21fbc (patch)
tree6681663a56ecdcdcc3a88cce19a3a5cc54778c47 /gnu/java/net
parentb7aad7b5fc47db20bb2db34b765928c20e507870 (diff)
downloadclasspath-39f4e18fc9d6769a1d5a3bb0f542fdcf77b21fbc.tar.gz
2004-07-28 Bryce McKinlay <mckinlay@redhat.com>
* 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'.
Diffstat (limited to 'gnu/java/net')
-rw-r--r--gnu/java/net/protocol/http/Connection.java54
1 files changed, 25 insertions, 29 deletions
diff --git a/gnu/java/net/protocol/http/Connection.java b/gnu/java/net/protocol/http/Connection.java
index 728d14a7e..e15fda862 100644
--- a/gnu/java/net/protocol/http/Connection.java
+++ b/gnu/java/net/protocol/http/Connection.java
@@ -59,6 +59,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import gnu.java.net.HeaderFieldHelper;
+import gnu.java.security.action.GetPropertyAction;
/**
* This subclass of java.net.URLConnection models a URLConnection via
@@ -88,36 +89,31 @@ public final class Connection extends HttpURLConnection
static
{
- // Make sure access control for system properties depends only on
- // our class ProtectionDomain, not on any (indirect) callers.
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run()
- {
- // Recognize some networking properties listed at
- // http://java.sun.com/j2se/1.4/docs/guide/net/properties.html.
- String port = null;
- proxyHost = System.getProperty("http.proxyHost");
- if (proxyHost != null)
- {
- proxyInUse = true;
- if ((port = System.getProperty("http.proxyPort")) != null)
- {
- try
- {
- proxyPort = Integer.parseInt(port);
- }
- catch (Throwable t)
- {
- // Nothing.
- }
- }
- }
-
- userAgent = System.getProperty("http.agent");
+ // Recognize some networking properties listed at
+ // http://java.sun.com/j2se/1.4/docs/guide/net/properties.html.
+ String port = null;
+ GetPropertyAction getProperty = new GetPropertyAction("http.proxyHost");
+ proxyHost = (String) AccessController.doPrivileged(getProperty);
+ if (proxyHost != null)
+ {
+ proxyInUse = true;
+ getProperty.setParameters("http.proxyPort");
+ port = (String) AccessController.doPrivileged(getProperty);
+ if (port != null)
+ {
+ try
+ {
+ proxyPort = Integer.parseInt(port);
+ }
+ catch (NumberFormatException ex)
+ {
+ // Nothing.
+ }
+ }
+ }
- return null;
- }
- });
+ getProperty.setParameters("http.agent");
+ userAgent = (String) AccessController.doPrivileged(getProperty);
}
/**