classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: System.getProperty & SecurityManager ; patches


From: Ewout Prangsma
Subject: Re: System.getProperty & SecurityManager ; patches
Date: Fri, 16 Apr 2004 08:27:44 +0200

Hi all,

I've attached the utilities classes and listed the placed that need
patching.
I'm sorry i'm not able to send you normal patch files, I've got a bit too
much changed for that still.

The principle is very simple.
Replace every
System.getProperty(..)
with
(String)AccessController.doPrivileged(new GetPropertyAction(key[, default]))


Here are the places i've found so far.


gnu.java.io.EncodingManager#<clinit>:

encoding_path = (String) AccessController.doPrivileged(new
GetPropertyAction("file.encoding.pkg"));

String default_encoding = (String) AccessController.doPrivileged(new
GetPropertyAction("file.encoding", "8859_1"));


gnu.java.io.EncodingManager#findDecoderConstructor(String, boolean):
String alias = (String) AccessController.doPrivileged(new
GetPropertyAction("gnu.java.io.encoding_scheme_alias." encoding));

gnu.java.io.EncodingManager#findEncoderConstructor(String, boolean):
String alias = (String) AccessController.doPrivileged(new
GetPropertyAction("gnu.java.io.encoding_scheme_alias."+ encoding));

gnu.java.net.protocol.http.Connection#<clinit>:
static {
// Recognize some networking properties listed at
// http://java.sun.com/j2se/1.4/docs/guide/net/properties.html.
proxyHost = (String)AccessController.doPrivileged(new
GetPropertyAction("http.proxyHost"));
if (proxyHost != null) {
proxyInUse = true;
final String port;
port = (String)AccessController.doPrivileged(new
GetPropertyAction("http.proxyPort"));
if (port != null) {
try {
proxyPort = Integer.parseInt(port);
} catch (Throwable t) {
// Nothing.
}
}
}
}

gnu.java.net.protocol.http.Connection#sendRequest:
if (getRequestProperty("user-agent") == null) {
// @classpath-bugfix
final String version = (String)AccessController.doPrivileged(new
GetPropertyAction("classpath.version"));
setRequestProperty("user-agent", "gnu-classpath/" + version);
}


java.awt.Toolkit#getDefaultToolkit:
final String toolkit_name = (String)AccessController.doPrivileged(new
GetPropertyAction("awt.toolkit", default_toolkit_name));

java.net.URL#<clinit>:
static {
final String s = (String) AccessController
.doPrivileged(new GetPropertyAction(
"gnu.java.net.nocache_protocol_handlers"));
cache_handlers = (s == null);
ph_search_path = (String) AccessController
.doPrivileged(new GetPropertyAction(
"java.protocol.handler.pkgs"));
// Tack our default package on at the ends
if (ph_search_path != null) {
ph_search_path = "org.jnode.protocol" + "|" + ph_search_path + "|"
+ "gnu.java.net.protocol";
} else {
ph_search_path = "org.jnode.protocol" + "|"
+ "gnu.java.net.protocol";
}
}

java.util.Locale#<clinit>:
private static Locale defaultLocale;
static {
final String lang = (String)AccessController.doPrivileged(new
GetPropertyAction("user.language", "en"));
final String region = (String)AccessController.doPrivileged(new
GetPropertyAction("user.region", ""));
final String variant= (String)AccessController.doPrivileged(new
GetPropertyAction("user.variant", ""));
defaultLocale = new Locale(lang, region, variant);
}
java.util.TimeZone#<clinit>:
static {
String tzid = (String)AccessController.doPrivileged(new
GetPropertyAction("user.timezone"));


Ewout

Attachment: SetPropertyAction.java
Description: Binary data

Attachment: GetBooleanAction.java
Description: Binary data

Attachment: GetIntegerAction.java
Description: Binary data

Attachment: GetPolicyAction.java
Description: Binary data

Attachment: GetPropertiesAction.java
Description: Binary data

Attachment: GetPropertyAction.java
Description: Binary data

Attachment: InvokeAction.java
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]