summaryrefslogtreecommitdiffstats
path: root/libjava/gnu/java/net/protocol
diff options
context:
space:
mode:
authorbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-23 22:20:14 +0000
committerbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-23 22:20:14 +0000
commite755efce8f87ba0b194aab239570f6a0690dc88a (patch)
tree96dc496d784f2249834ceb7610963655c445967c /libjava/gnu/java/net/protocol
parentad90b13f383877b0b26898d35fcf349188d6c277 (diff)
downloadppe42-gcc-e755efce8f87ba0b194aab239570f6a0690dc88a.tar.gz
ppe42-gcc-e755efce8f87ba0b194aab239570f6a0690dc88a.zip
2004-07-23 Bryce McKinlay <mckinlay@redhat.com>
* gnu/java/net/protocol/http/Connection.java: Use GetPropertyAction for privileged getProperty calls. * java/io/ObjectOutputStream.java (getField): No longer static. Use SetAccessibleAction instead of anonymous class for doPrivileged call. (getMethod): Likewise. (setAccessible): New field. PrivilegedAction object to use when calling setAccessible. * java/io/ObjectStreamClass.java (calculateOffsets): Use SetAccessibleAction instead of anonymous class for diPrivileged call. (setFields): Likewise. (getClassUID): Likewise. (findMethod): Likewise. * gnu/java/security/action/GetPropertyAction.java: New class. * gnu/java/security/action/SetAccessibleAction.java: New class. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85097 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu/java/net/protocol')
-rw-r--r--libjava/gnu/java/net/protocol/http/Connection.java54
1 files changed, 25 insertions, 29 deletions
diff --git a/libjava/gnu/java/net/protocol/http/Connection.java b/libjava/gnu/java/net/protocol/http/Connection.java
index 728d14a7e6b..ccae499dc33 100644
--- a/libjava/gnu/java/net/protocol/http/Connection.java
+++ b/libjava/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.setName("http.proxyPort");
+ port = (String) AccessController.doPrivileged(getProperty);
+ if (port != null)
+ {
+ try
+ {
+ proxyPort = Integer.parseInt(port);
+ }
+ catch (NumberFormatException ex)
+ {
+ // Nothing.
+ }
+ }
+ }
- return null;
- }
- });
+ getProperty.setName("http.agent");
+ userAgent = (String) AccessController.doPrivileged(getProperty);
}
/**
OpenPOWER on IntegriCloud