8155775: Re-examine naming of privileged methods to access System properties
Reviewed-by: mullan
This commit is contained in:
parent
44790114ee
commit
e8cd76568d
@ -102,7 +102,7 @@ public class LinuxFileSystemProvider extends UnixFileSystemProvider {
|
||||
|
||||
@Override
|
||||
FileTypeDetector getFileTypeDetector() {
|
||||
String userHome = GetPropertyAction.getProperty("user.home");
|
||||
String userHome = GetPropertyAction.privilegedGetProperty("user.home");
|
||||
Path userMimeTypes = Paths.get(userHome, ".mime.types");
|
||||
Path etcMimeTypes = Paths.get("/etc/mime.types");
|
||||
|
||||
|
@ -84,7 +84,8 @@ class KQueueArrayWrapper {
|
||||
static {
|
||||
IOUtil.load();
|
||||
initStructSizes();
|
||||
String datamodel = GetPropertyAction.getProperty("sun.arch.data.model");
|
||||
String datamodel =
|
||||
GetPropertyAction.privilegedGetProperty("sun.arch.data.model");
|
||||
is64bit = "64".equals(datamodel);
|
||||
}
|
||||
|
||||
|
@ -29,8 +29,6 @@ import java.nio.file.*;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
import java.security.AccessController;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
import static sun.nio.fs.MacOSXNativeDispatcher.*;
|
||||
|
||||
|
@ -46,8 +46,8 @@ public class MacOSXFileSystemProvider extends BsdFileSystemProvider {
|
||||
|
||||
@Override
|
||||
FileTypeDetector getFileTypeDetector() {
|
||||
Path userMimeTypes = Paths.get(
|
||||
GetPropertyAction.getProperty("user.home"), ".mime.types");
|
||||
Path userMimeTypes = Paths.get(GetPropertyAction
|
||||
.privilegedGetProperty("user.home"), ".mime.types");
|
||||
|
||||
return chain(new MimeTypesFileTypeDetector(userMimeTypes),
|
||||
new UTIFileTypeDetector());
|
||||
|
@ -1896,7 +1896,7 @@ public class File
|
||||
|
||||
// temporary directory location
|
||||
private static final File tmpdir = new File(
|
||||
GetPropertyAction.getProperty("java.io.tmpdir"));
|
||||
GetPropertyAction.privilegedGetProperty("java.io.tmpdir"));
|
||||
static File location() {
|
||||
return tmpdir;
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ public final class ProcessBuilder
|
||||
*/
|
||||
public abstract static class Redirect {
|
||||
private static final File NULL_FILE = new File(
|
||||
(GetPropertyAction.getProperty("os.name")
|
||||
(GetPropertyAction.privilegedGetProperty("os.name")
|
||||
.startsWith("Windows") ? "NUL" : "/dev/null")
|
||||
);
|
||||
|
||||
|
@ -78,7 +78,8 @@ final class StackStreamFactory {
|
||||
* Performance work and extensive testing is needed to replace the
|
||||
* VM built-in backtrace filled in Throwable with the StackWalker.
|
||||
*/
|
||||
final static boolean isDebug = getProperty("stackwalk.debug", false);
|
||||
final static boolean isDebug =
|
||||
"true".equals(GetPropertyAction.privilegedGetProperty("stackwalk.debug"));
|
||||
|
||||
static <T> StackFrameTraverser<T>
|
||||
makeStackTraverser(StackWalker walker, Function<? super Stream<StackFrame>, ? extends T> function)
|
||||
@ -988,11 +989,4 @@ final class StackStreamFactory {
|
||||
c.getName().startsWith("java.lang.invoke.LambdaForm");
|
||||
}
|
||||
|
||||
private static boolean getProperty(String key, boolean value) {
|
||||
String s = GetPropertyAction.getProperty(key);
|
||||
if (s != null) {
|
||||
return Boolean.parseBoolean(s);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
|
||||
static {
|
||||
final String key = "jdk.internal.lambda.dumpProxyClasses";
|
||||
String path = GetPropertyAction.getProperty(key);
|
||||
String path = GetPropertyAction.privilegedGetProperty(key);
|
||||
dumper = (null == path) ? null : ProxyClassesDumper.getInstance(path);
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ import sun.security.action.GetPropertyAction;
|
||||
static final boolean VAR_HANDLE_GUARDS;
|
||||
|
||||
static {
|
||||
Properties props = GetPropertyAction.getProperties();
|
||||
Properties props = GetPropertyAction.privilegedGetProperties();
|
||||
DEBUG_METHOD_HANDLE_NAMES = Boolean.parseBoolean(
|
||||
props.getProperty("java.lang.invoke.MethodHandle.DEBUG_NAMES"));
|
||||
DUMP_CLASS_FILES = Boolean.parseBoolean(
|
||||
|
@ -197,7 +197,7 @@ public final class StringConcatFactory {
|
||||
// DEBUG = false; // implied
|
||||
// DUMPER = null; // implied
|
||||
|
||||
Properties props = GetPropertyAction.getProperties();
|
||||
Properties props = GetPropertyAction.privilegedGetProperties();
|
||||
final String strategy =
|
||||
props.getProperty("java.lang.invoke.stringConcat");
|
||||
CACHE_ENABLE = Boolean.parseBoolean(
|
||||
|
@ -582,7 +582,7 @@ public class Proxy implements java.io.Serializable {
|
||||
}
|
||||
|
||||
private static final String DEBUG =
|
||||
GetPropertyAction.getProperty("jdk.proxy.debug", "");
|
||||
GetPropertyAction.privilegedGetProperty("jdk.proxy.debug", "");
|
||||
|
||||
private static boolean isDebug() {
|
||||
return !DEBUG.isEmpty();
|
||||
|
@ -52,7 +52,8 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl
|
||||
protected InetAddress connectedAddress = null;
|
||||
private int connectedPort = -1;
|
||||
|
||||
private static final String os = GetPropertyAction.getProperty("os.name");
|
||||
private static final String os =
|
||||
GetPropertyAction.privilegedGetProperty("os.name");
|
||||
|
||||
/**
|
||||
* flag set if the native connect() call not to be used
|
||||
|
@ -1124,7 +1124,7 @@ class InetAddress implements java.io.Serializable {
|
||||
private static NameService createNameService() {
|
||||
|
||||
String hostsFileName =
|
||||
GetPropertyAction.getProperty("jdk.net.hosts.file");
|
||||
GetPropertyAction.privilegedGetProperty("jdk.net.hosts.file");
|
||||
NameService theNameService;
|
||||
if (hostsFileName != null) {
|
||||
theNameService = new HostsFileNameService(hostsFileName);
|
||||
@ -1643,7 +1643,7 @@ class InetAddress implements java.io.Serializable {
|
||||
* property can vary across implementations of the java.
|
||||
* classes. The default is an empty String "".
|
||||
*/
|
||||
String prefix = GetPropertyAction.getProperty("impl.prefix", "");
|
||||
String prefix = GetPropertyAction.privilegedGetProperty("impl.prefix", "");
|
||||
try {
|
||||
impl = Class.forName("java.net." + prefix + implName).newInstance();
|
||||
} catch (ClassNotFoundException e) {
|
||||
|
@ -178,7 +178,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
||||
userName = pw.getUserName();
|
||||
password = new String(pw.getPassword());
|
||||
} else {
|
||||
userName = GetPropertyAction.getProperty("user.name");
|
||||
userName = GetPropertyAction.privilegedGetProperty("user.name");
|
||||
}
|
||||
if (userName == null)
|
||||
return false;
|
||||
@ -1088,7 +1088,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
||||
userName = System.getProperty("user.name");
|
||||
} catch (SecurityException se) { /* swallow Exception */ }
|
||||
} else {
|
||||
userName = GetPropertyAction.getProperty("user.name");
|
||||
userName = GetPropertyAction.privilegedGetProperty("user.name");
|
||||
}
|
||||
return userName;
|
||||
}
|
||||
|
@ -1212,7 +1212,7 @@ public final class URL implements java.io.Serializable {
|
||||
|
||||
private static URLStreamHandler lookupViaProperty(String protocol) {
|
||||
String packagePrefixList =
|
||||
GetPropertyAction.getProperty(protocolPathProp);
|
||||
GetPropertyAction.privilegedGetProperty(protocolPathProp);
|
||||
if (packagePrefixList == null) {
|
||||
// not set
|
||||
return null;
|
||||
|
@ -1397,7 +1397,7 @@ public abstract class URLConnection {
|
||||
*/
|
||||
private String getContentHandlerPkgPrefixes() {
|
||||
String packagePrefixList =
|
||||
GetPropertyAction.getProperty(contentPathProp, "");
|
||||
GetPropertyAction.privilegedGetProperty(contentPathProp, "");
|
||||
|
||||
if (packagePrefixList != "") {
|
||||
packagePrefixList += "|";
|
||||
|
@ -133,7 +133,7 @@ public class URLEncoder {
|
||||
dontNeedEncoding.set('.');
|
||||
dontNeedEncoding.set('*');
|
||||
|
||||
dfltEncName = GetPropertyAction.getProperty("file.encoding");
|
||||
dfltEncName = GetPropertyAction.privilegedGetProperty("file.encoding");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -283,8 +283,8 @@ public abstract class Charset
|
||||
if (level == null) {
|
||||
if (!VM.isBooted())
|
||||
return false;
|
||||
bugLevel = level =
|
||||
GetPropertyAction.getProperty("sun.nio.cs.bugLevel", "");
|
||||
bugLevel = level = GetPropertyAction
|
||||
.privilegedGetProperty("sun.nio.cs.bugLevel", "");
|
||||
}
|
||||
return level.equals(bl);
|
||||
}
|
||||
@ -609,7 +609,8 @@ public abstract class Charset
|
||||
public static Charset defaultCharset() {
|
||||
if (defaultCharset == null) {
|
||||
synchronized (Charset.class) {
|
||||
String csn = GetPropertyAction.getProperty("file.encoding");
|
||||
String csn = GetPropertyAction
|
||||
.privilegedGetProperty("file.encoding");
|
||||
Charset cs = lookup(csn);
|
||||
if (cs != null)
|
||||
defaultCharset = cs;
|
||||
|
@ -46,7 +46,7 @@ class TempFileHelper {
|
||||
|
||||
// temporary directory location
|
||||
private static final Path tmpdir =
|
||||
Paths.get(GetPropertyAction.getProperty("java.io.tmpdir"));
|
||||
Paths.get(GetPropertyAction.privilegedGetProperty("java.io.tmpdir"));
|
||||
|
||||
private static final boolean isPosix =
|
||||
FileSystems.getDefault().supportedFileAttributeViews().contains("posix");
|
||||
|
@ -858,7 +858,7 @@ public final class Locale implements Cloneable, Serializable {
|
||||
|
||||
private static Locale initDefault() {
|
||||
String language, region, script, country, variant;
|
||||
Properties props = GetPropertyAction.getProperties();
|
||||
Properties props = GetPropertyAction.privilegedGetProperties();
|
||||
language = props.getProperty("user.language", "en");
|
||||
// for compatibility, check for old user.region property
|
||||
region = props.getProperty("user.region");
|
||||
@ -883,7 +883,7 @@ public final class Locale implements Cloneable, Serializable {
|
||||
}
|
||||
|
||||
private static Locale initDefault(Locale.Category category) {
|
||||
Properties props = GetPropertyAction.getProperties();
|
||||
Properties props = GetPropertyAction.privilegedGetProperties();
|
||||
return getInstance(
|
||||
props.getProperty(category.languageKey,
|
||||
defaultLocale.getLanguage()),
|
||||
|
@ -140,9 +140,8 @@ public class PropertyResourceBundle extends ResourceBundle {
|
||||
|
||||
// Check whether the strict encoding is specified.
|
||||
// The possible encoding is either "ISO-8859-1" or "UTF-8".
|
||||
private static final String encoding =
|
||||
GetPropertyAction
|
||||
.getProperty("java.util.PropertyResourceBundle.encoding", "")
|
||||
private static final String encoding = GetPropertyAction
|
||||
.privilegedGetProperty("java.util.PropertyResourceBundle.encoding", "")
|
||||
.toUpperCase(Locale.ROOT);
|
||||
|
||||
/**
|
||||
|
@ -42,6 +42,7 @@ import java.io.Serializable;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Properties;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
import sun.util.calendar.ZoneInfo;
|
||||
import sun.util.calendar.ZoneInfoFile;
|
||||
@ -660,12 +661,13 @@ public abstract class TimeZone implements Serializable, Cloneable {
|
||||
private static synchronized TimeZone setDefaultZone() {
|
||||
TimeZone tz;
|
||||
// get the time zone ID from the system properties
|
||||
String zoneID = GetPropertyAction.getProperty("user.timezone");
|
||||
Properties props = GetPropertyAction.privilegedGetProperties();
|
||||
String zoneID = props.getProperty("user.timezone");
|
||||
|
||||
// if the time zone ID is not set (yet), perform the
|
||||
// platform to Java time zone ID mapping.
|
||||
if (zoneID == null || zoneID.isEmpty()) {
|
||||
String javaHome = GetPropertyAction.getProperty("java.home");
|
||||
String javaHome = props.getProperty("java.home");
|
||||
try {
|
||||
zoneID = getSystemTimeZoneID(javaHome);
|
||||
if (zoneID == null) {
|
||||
@ -693,13 +695,7 @@ public abstract class TimeZone implements Serializable, Cloneable {
|
||||
assert tz != null;
|
||||
|
||||
final String id = zoneID;
|
||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public Void run() {
|
||||
System.setProperty("user.timezone", id);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
props.setProperty("user.timezone", id);
|
||||
|
||||
defaultTimeZone = tz;
|
||||
return tz;
|
||||
|
@ -155,7 +155,7 @@ class JarFile extends ZipFile {
|
||||
BASE_VERSION = 8; // one less than lowest version for versioned entries
|
||||
int runtimeVersion = jdk.Version.current().major();
|
||||
String jarVersion =
|
||||
GetPropertyAction.getProperty("jdk.util.jar.version");
|
||||
GetPropertyAction.privilegedGetProperty("jdk.util.jar.version");
|
||||
if (jarVersion != null) {
|
||||
int jarVer = Integer.parseInt(jarVersion);
|
||||
runtimeVersion = (jarVer > runtimeVersion)
|
||||
@ -163,7 +163,7 @@ class JarFile extends ZipFile {
|
||||
}
|
||||
RUNTIME_VERSION = runtimeVersion;
|
||||
String enableMultiRelease = GetPropertyAction
|
||||
.getProperty("jdk.util.jar.enableMultiRelease", "true");
|
||||
.privilegedGetProperty("jdk.util.jar.enableMultiRelease", "true");
|
||||
switch (enableMultiRelease) {
|
||||
case "true":
|
||||
default:
|
||||
|
@ -695,7 +695,7 @@ public abstract class Pack200 {
|
||||
Class<?> impl = (PACK_PROVIDER.equals(prop))? packerImpl: unpackerImpl;
|
||||
if (impl == null) {
|
||||
// The first time, we must decide which class to use.
|
||||
implName = GetPropertyAction.getProperty(prop,"");
|
||||
implName = GetPropertyAction.privilegedGetProperty(prop,"");
|
||||
if (implName != null && !implName.equals(""))
|
||||
impl = Class.forName(implName);
|
||||
else if (PACK_PROVIDER.equals(prop))
|
||||
|
@ -94,7 +94,7 @@ public class PatternSyntaxException
|
||||
}
|
||||
|
||||
private static final String nl =
|
||||
GetPropertyAction.getProperty("line.separator");
|
||||
GetPropertyAction.privilegedGetProperty("line.separator");
|
||||
|
||||
/**
|
||||
* Returns a multi-line string containing the description of the syntax
|
||||
|
@ -55,7 +55,7 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
|
||||
*/
|
||||
private static final boolean inhibitZip64 =
|
||||
Boolean.parseBoolean(
|
||||
GetPropertyAction.getProperty("jdk.util.zip.inhibitZip64"));
|
||||
GetPropertyAction.privilegedGetProperty("jdk.util.zip.inhibitZip64"));
|
||||
|
||||
private static class XEntry {
|
||||
final ZipEntry entry;
|
||||
|
@ -51,7 +51,7 @@ public abstract class SSLSocketFactory extends SocketFactory
|
||||
static final boolean DEBUG;
|
||||
|
||||
static {
|
||||
String s = GetPropertyAction.getProperty("javax.net.debug", "")
|
||||
String s = GetPropertyAction.privilegedGetProperty("javax.net.debug", "")
|
||||
.toLowerCase(Locale.ENGLISH);
|
||||
|
||||
DEBUG = s.contains("all") || s.contains("ssl");
|
||||
|
@ -273,7 +273,8 @@ public final class Version
|
||||
*/
|
||||
public static Version current() {
|
||||
if (current == null) {
|
||||
current = parse(GetPropertyAction.getProperty("java.version"));
|
||||
current = parse(
|
||||
GetPropertyAction.privilegedGetProperty("java.version"));
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public class URLClassPath {
|
||||
private static final boolean DISABLE_JAR_CHECKING;
|
||||
|
||||
static {
|
||||
Properties props = GetPropertyAction.getProperties();
|
||||
Properties props = GetPropertyAction.privilegedGetProperties();
|
||||
JAVA_VERSION = props.getProperty("java.version");
|
||||
DEBUG = (props.getProperty("sun.misc.URLClassPath.debug") != null);
|
||||
String p = props.getProperty("sun.misc.URLClassPath.disableJarChecking");
|
||||
|
@ -81,7 +81,7 @@ public final class LoggerFinderLoader {
|
||||
// Get configuration error policy
|
||||
private static ErrorPolicy configurationErrorPolicy() {
|
||||
String errorPolicy =
|
||||
GetPropertyAction.getProperty("jdk.logger.finder.error");
|
||||
GetPropertyAction.privilegedGetProperty("jdk.logger.finder.error");
|
||||
if (errorPolicy == null || errorPolicy.isEmpty()) {
|
||||
return ErrorPolicy.WARNING;
|
||||
}
|
||||
@ -96,7 +96,7 @@ public final class LoggerFinderLoader {
|
||||
// This is further submitted to the configuration error policy.
|
||||
private static boolean ensureSingletonProvider() {
|
||||
return Boolean.parseBoolean(
|
||||
GetPropertyAction.getProperty("jdk.logger.finder.singleton"));
|
||||
GetPropertyAction.privilegedGetProperty("jdk.logger.finder.singleton"));
|
||||
}
|
||||
|
||||
private static Iterator<System.LoggerFinder> findLoggerFinderProviders() {
|
||||
|
@ -56,7 +56,7 @@ public class SimpleConsoleLogger extends LoggerConfiguration
|
||||
|
||||
static Level getDefaultLevel() {
|
||||
String levelName = GetPropertyAction
|
||||
.getProperty("jdk.system.logger.level", "INFO");
|
||||
.privilegedGetProperty("jdk.system.logger.level", "INFO");
|
||||
try {
|
||||
return Level.valueOf(levelName);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
@ -426,7 +426,7 @@ public class SimpleConsoleLogger extends LoggerConfiguration
|
||||
static private final String[] skips;
|
||||
static {
|
||||
String additionalPkgs =
|
||||
GetPropertyAction.getProperty("jdk.logger.packages");
|
||||
GetPropertyAction.privilegedGetProperty("jdk.logger.packages");
|
||||
skips = additionalPkgs == null ? new String[0] : additionalPkgs.split(",");
|
||||
}
|
||||
|
||||
@ -485,7 +485,7 @@ public class SimpleConsoleLogger extends LoggerConfiguration
|
||||
// jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java
|
||||
// to fail - because that test has a testcase which somehow references
|
||||
// PlatformLogger and counts the number of generated lambda classes.
|
||||
String format = GetPropertyAction.getProperty(key);
|
||||
String format = GetPropertyAction.privilegedGetProperty(key);
|
||||
|
||||
if (format == null && defaultPropertyGetter != null) {
|
||||
format = defaultPropertyGetter.apply(key);
|
||||
|
@ -343,8 +343,8 @@ public class Reflection {
|
||||
|
||||
private static void printStackTraceIfNeeded(Throwable e) {
|
||||
if (!printStackWhenAccessFailsSet && VM.initLevel() >= 1) {
|
||||
String s = GetPropertyAction
|
||||
.getProperty("sun.reflect.debugModuleAccessChecks");
|
||||
String s = GetPropertyAction.privilegedGetProperty(
|
||||
"sun.reflect.debugModuleAccessChecks");
|
||||
printStackWhenAccessFails =
|
||||
(s != null && !s.equalsIgnoreCase("false"));
|
||||
printStackWhenAccessFailsSet = true;
|
||||
|
@ -398,7 +398,7 @@ public class ReflectionFactory {
|
||||
return;
|
||||
}
|
||||
|
||||
Properties props = GetPropertyAction.getProperties();
|
||||
Properties props = GetPropertyAction.privilegedGetProperties();
|
||||
String val = props.getProperty("sun.reflect.noInflation");
|
||||
if (val != null && val.equals("true")) {
|
||||
noInflation = true;
|
||||
|
@ -53,8 +53,8 @@ public class ResourceManager {
|
||||
private static final AtomicInteger numSockets;
|
||||
|
||||
static {
|
||||
String prop =
|
||||
GetPropertyAction.getProperty("sun.net.maxDatagramSockets");
|
||||
String prop = GetPropertyAction
|
||||
.privilegedGetProperty("sun.net.maxDatagramSockets");
|
||||
int defmax = DEFAULT_MAX_SOCKETS;
|
||||
try {
|
||||
if (prop != null) {
|
||||
|
@ -40,7 +40,7 @@ import sun.security.action.GetPropertyAction;
|
||||
*/
|
||||
|
||||
public final class SdpSupport {
|
||||
private static final String os = GetPropertyAction.getProperty("os.name");
|
||||
private static final String os = GetPropertyAction.privilegedGetProperty("os.name");
|
||||
private static final boolean isSupported = (os.equals("SunOS") || (os.equals("Linux")));
|
||||
private static final JavaIOFileDescriptorAccess fdAccess =
|
||||
SharedSecrets.getJavaIOFileDescriptorAccess();
|
||||
|
@ -157,7 +157,7 @@ public class SmtpClient extends TransferProtocolClient {
|
||||
}
|
||||
try {
|
||||
String s;
|
||||
mailhost = GetPropertyAction.getProperty("mail.host");
|
||||
mailhost = GetPropertyAction.privilegedGetProperty("mail.host");
|
||||
if (mailhost != null) {
|
||||
openServer(mailhost);
|
||||
return;
|
||||
@ -183,7 +183,7 @@ public class SmtpClient extends TransferProtocolClient {
|
||||
setConnectTimeout(to);
|
||||
try {
|
||||
String s;
|
||||
mailhost = GetPropertyAction.getProperty("mail.host");
|
||||
mailhost = GetPropertyAction.privilegedGetProperty("mail.host");
|
||||
if (mailhost != null) {
|
||||
openServer(mailhost);
|
||||
return;
|
||||
|
@ -183,7 +183,7 @@ class MimeLauncher extends Thread {
|
||||
}
|
||||
|
||||
String execPathList;
|
||||
execPathList = GetPropertyAction.getProperty("exec.path");
|
||||
execPathList = GetPropertyAction.privilegedGetProperty("exec.path");
|
||||
if (execPathList == null) {
|
||||
// exec.path property not set
|
||||
return false;
|
||||
|
@ -145,7 +145,7 @@ public class HttpClient extends NetworkClient {
|
||||
}
|
||||
|
||||
static {
|
||||
Properties props = GetPropertyAction.getProperties();
|
||||
Properties props = GetPropertyAction.privilegedGetProperties();
|
||||
String keepAlive = props.getProperty("http.keepAlive");
|
||||
String retryPost = props.getProperty("sun.net.http.retryPost");
|
||||
|
||||
|
@ -278,7 +278,7 @@ public class FtpURLConnection extends URLConnection {
|
||||
|
||||
if (user == null) {
|
||||
user = "anonymous";
|
||||
Properties props = GetPropertyAction.getProperties();
|
||||
Properties props = GetPropertyAction.privilegedGetProperties();
|
||||
String vers = props.getProperty("java.version");
|
||||
password = props.getProperty("ftp.protocol.user",
|
||||
"Java" + vers + "@");
|
||||
|
@ -94,7 +94,7 @@ public class AuthenticationHeader {
|
||||
}
|
||||
|
||||
static {
|
||||
authPref = GetPropertyAction.getProperty("http.auth.preference");
|
||||
authPref = GetPropertyAction.privilegedGetProperty("http.auth.preference");
|
||||
|
||||
// http.auth.preference can be set to SPNEGO or Kerberos.
|
||||
// In fact they means "Negotiate with SPNEGO" and "Negotiate with
|
||||
|
@ -207,9 +207,9 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
||||
};
|
||||
|
||||
static {
|
||||
Properties props = GetPropertyAction.getProperties();
|
||||
maxRedirects = GetIntegerAction.getProperty("http.maxRedirects",
|
||||
defaultmaxRedirects);
|
||||
Properties props = GetPropertyAction.privilegedGetProperties();
|
||||
maxRedirects = GetIntegerAction.privilegedGetProperty(
|
||||
"http.maxRedirects", defaultmaxRedirects);
|
||||
version = props.getProperty("java.version");
|
||||
String agent = props.getProperty("http.agent");
|
||||
if (agent == null) {
|
||||
@ -225,14 +225,14 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
||||
|
||||
enableESBuffer = Boolean.parseBoolean(
|
||||
props.getProperty("sun.net.http.errorstream.enableBuffering"));
|
||||
timeout4ESBuffer = GetIntegerAction
|
||||
.getProperty("sun.net.http.errorstream.timeout", 300);
|
||||
timeout4ESBuffer = GetIntegerAction.privilegedGetProperty(
|
||||
"sun.net.http.errorstream.timeout", 300);
|
||||
if (timeout4ESBuffer <= 0) {
|
||||
timeout4ESBuffer = 300; // use the default
|
||||
}
|
||||
|
||||
bufSize4ES = GetIntegerAction
|
||||
.getProperty("sun.net.http.errorstream.bufferSize", 4096);
|
||||
bufSize4ES = GetIntegerAction.privilegedGetProperty(
|
||||
"sun.net.http.errorstream.bufferSize", 4096);
|
||||
if (bufSize4ES <= 0) {
|
||||
bufSize4ES = 4096; // use the default
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ final class HttpsClient extends HttpClient
|
||||
//
|
||||
String ciphers [];
|
||||
String cipherString =
|
||||
GetPropertyAction.getProperty("https.cipherSuites");
|
||||
GetPropertyAction.privilegedGetProperty("https.cipherSuites");
|
||||
|
||||
if (cipherString == null || "".equals(cipherString)) {
|
||||
ciphers = null;
|
||||
@ -163,7 +163,7 @@ final class HttpsClient extends HttpClient
|
||||
//
|
||||
String protocols [];
|
||||
String protocolString =
|
||||
GetPropertyAction.getProperty("https.protocols");
|
||||
GetPropertyAction.privilegedGetProperty("https.protocols");
|
||||
|
||||
if (protocolString == null || "".equals(protocolString)) {
|
||||
protocols = null;
|
||||
@ -183,7 +183,8 @@ final class HttpsClient extends HttpClient
|
||||
}
|
||||
|
||||
private String getUserAgent() {
|
||||
String userAgent = GetPropertyAction.getProperty("https.agent");
|
||||
String userAgent =
|
||||
GetPropertyAction.privilegedGetProperty("https.agent");
|
||||
if (userAgent == null || userAgent.length() == 0) {
|
||||
userAgent = "JSSE";
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ public class JavaRuntimeURLConnection extends URLConnection {
|
||||
public Permission getPermission() throws IOException {
|
||||
Permission p = permission;
|
||||
if (p == null) {
|
||||
String home = GetPropertyAction.getProperty("java.home");
|
||||
String home = GetPropertyAction.privilegedGetProperty("java.home");
|
||||
p = new FilePermission(home + File.separator + "-", "read");
|
||||
permission = p;
|
||||
}
|
||||
|
@ -56,9 +56,9 @@ public class Handler extends URLStreamHandler {
|
||||
URL ru;
|
||||
|
||||
boolean localonly = Boolean.parseBoolean(
|
||||
GetPropertyAction.getProperty("newdoc.localonly"));
|
||||
GetPropertyAction.privilegedGetProperty("newdoc.localonly"));
|
||||
|
||||
String docurl = GetPropertyAction.getProperty("doc.url");
|
||||
String docurl = GetPropertyAction.privilegedGetProperty("doc.url");
|
||||
|
||||
String file = u.getFile();
|
||||
if (!localonly) {
|
||||
|
@ -1019,7 +1019,7 @@ public class FileChannelImpl
|
||||
if (!propertyChecked) {
|
||||
synchronized (FileChannelImpl.class) {
|
||||
if (!propertyChecked) {
|
||||
String value = GetPropertyAction.getProperty(
|
||||
String value = GetPropertyAction.privilegedGetProperty(
|
||||
"sun.nio.ch.disableSystemWideOverlappingFileLockCheck");
|
||||
isSharedFileLockTable = ((value == null) || value.equals("false"));
|
||||
propertyChecked = true;
|
||||
|
@ -374,8 +374,8 @@ public class Net {
|
||||
}
|
||||
|
||||
public static boolean isFastTcpLoopbackRequested() {
|
||||
String loopbackProp =
|
||||
GetPropertyAction.getProperty("jdk.net.useFastTcpLoopback");
|
||||
String loopbackProp = GetPropertyAction
|
||||
.privilegedGetProperty("jdk.net.useFastTcpLoopback");
|
||||
boolean enable;
|
||||
if ("".equals(loopbackProp)) {
|
||||
enable = true;
|
||||
@ -633,8 +633,8 @@ public class Net {
|
||||
static {
|
||||
int availLevel = isExclusiveBindAvailable();
|
||||
if (availLevel >= 0) {
|
||||
String exclBindProp =
|
||||
GetPropertyAction.getProperty("sun.net.useExclusiveBind");
|
||||
String exclBindProp = GetPropertyAction
|
||||
.privilegedGetProperty("sun.net.useExclusiveBind");
|
||||
if (exclBindProp != null) {
|
||||
exclusiveBind = exclBindProp.isEmpty() ?
|
||||
true : Boolean.parseBoolean(exclBindProp);
|
||||
|
@ -64,7 +64,8 @@ public class Util {
|
||||
* for potential future-proofing.
|
||||
*/
|
||||
private static long getMaxCachedBufferSize() {
|
||||
String s = GetPropertyAction.getProperty("jdk.nio.maxCachedBufferSize");
|
||||
String s = GetPropertyAction
|
||||
.privilegedGetProperty("jdk.nio.maxCachedBufferSize");
|
||||
if (s != null) {
|
||||
try {
|
||||
long m = Long.parseLong(s);
|
||||
@ -465,7 +466,8 @@ public class Util {
|
||||
if (bugLevel == null) {
|
||||
if (!jdk.internal.misc.VM.isBooted())
|
||||
return false;
|
||||
String value = GetPropertyAction.getProperty("sun.nio.ch.bugLevel");
|
||||
String value = GetPropertyAction
|
||||
.privilegedGetProperty("sun.nio.ch.bugLevel");
|
||||
bugLevel = (value != null) ? value : "";
|
||||
}
|
||||
return bugLevel.equals(bl);
|
||||
|
@ -164,7 +164,7 @@ public class StandardCharsets extends CharsetProvider {
|
||||
return;
|
||||
initialized = true;
|
||||
|
||||
String map = getProperty("sun.nio.cs.map");
|
||||
String map = GetPropertyAction.privilegedGetProperty("sun.nio.cs.map");
|
||||
if (map != null) {
|
||||
String[] maps = map.split(",");
|
||||
for (int i = 0; i < maps.length; i++) {
|
||||
@ -199,9 +199,4 @@ public class StandardCharsets extends CharsetProvider {
|
||||
}
|
||||
}
|
||||
|
||||
private static String getProperty(String key) {
|
||||
return GetPropertyAction.getProperty(key);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class Util {
|
||||
private Util() { }
|
||||
|
||||
private static final Charset jnuEncoding = Charset.forName(
|
||||
GetPropertyAction.getProperty("sun.jnu.encoding"));
|
||||
GetPropertyAction.privilegedGetProperty("sun.jnu.encoding"));
|
||||
|
||||
/**
|
||||
* Returns {@code Charset} corresponding to the sun.jnu.encoding property
|
||||
|
@ -118,9 +118,14 @@ public class GetIntegerAction
|
||||
* if no security manager is present. This is unsafe for inclusion in a
|
||||
* public API but allowable here since this class is now encapsulated.
|
||||
*
|
||||
* Note that this method performs a privileged action using caller-provided
|
||||
* inputs. The caller of this method should take care to ensure that the
|
||||
* inputs are not tainted and the returned property is not made accessible
|
||||
* to untrusted code if it contains sensitive information.
|
||||
*
|
||||
* @param theProp the name of the system property.
|
||||
*/
|
||||
public static Integer getProperty(String theProp) {
|
||||
public static Integer privilegedGetProperty(String theProp) {
|
||||
if (System.getSecurityManager() == null) {
|
||||
return Integer.getInteger(theProp);
|
||||
} else {
|
||||
@ -134,10 +139,16 @@ public class GetIntegerAction
|
||||
* if no security manager is present. This is unsafe for inclusion in a
|
||||
* public API but allowable here since this class is now encapsulated.
|
||||
*
|
||||
* Note that this method performs a privileged action using caller-provided
|
||||
* inputs. The caller of this method should take care to ensure that the
|
||||
* inputs are not tainted and the returned property is not made accessible
|
||||
* to untrusted code if it contains sensitive information.
|
||||
*
|
||||
* @param theProp the name of the system property.
|
||||
* @param defaultVal the default value.
|
||||
*/
|
||||
public static Integer getProperty(String theProp, int defaultVal) {
|
||||
public static Integer privilegedGetProperty(String theProp,
|
||||
int defaultVal) {
|
||||
Integer value;
|
||||
if (System.getSecurityManager() == null) {
|
||||
value = Integer.getInteger(theProp);
|
||||
|
@ -93,9 +93,14 @@ public class GetPropertyAction implements PrivilegedAction<String> {
|
||||
* if no security manager is present. This is unsafe for inclusion in a
|
||||
* public API but allowable here since this class is now encapsulated.
|
||||
*
|
||||
* Note that this method performs a privileged action using caller-provided
|
||||
* inputs. The caller of this method should take care to ensure that the
|
||||
* inputs are not tainted and the returned property is not made accessible
|
||||
* to untrusted code if it contains sensitive information.
|
||||
*
|
||||
* @param theProp the name of the system property.
|
||||
*/
|
||||
public static String getProperty(String theProp) {
|
||||
public static String privilegedGetProperty(String theProp) {
|
||||
if (System.getSecurityManager() == null) {
|
||||
return System.getProperty(theProp);
|
||||
} else {
|
||||
@ -109,10 +114,16 @@ public class GetPropertyAction implements PrivilegedAction<String> {
|
||||
* if no security manager is present. This is unsafe for inclusion in a
|
||||
* public API but allowable here since this class is now encapsulated.
|
||||
*
|
||||
* Note that this method performs a privileged action using caller-provided
|
||||
* inputs. The caller of this method should take care to ensure that the
|
||||
* inputs are not tainted and the returned property is not made accessible
|
||||
* to untrusted code if it contains sensitive information.
|
||||
*
|
||||
* @param theProp the name of the system property.
|
||||
* @param defaultVal the default value.
|
||||
*/
|
||||
public static String getProperty(String theProp, String defaultVal) {
|
||||
public static String privilegedGetProperty(String theProp,
|
||||
String defaultVal) {
|
||||
if (System.getSecurityManager() == null) {
|
||||
return System.getProperty(theProp, defaultVal);
|
||||
} else {
|
||||
@ -126,8 +137,13 @@ public class GetPropertyAction implements PrivilegedAction<String> {
|
||||
* having to go through doPrivileged if no security manager is present.
|
||||
* This is unsafe for inclusion in a public API but allowable here since
|
||||
* this class is now encapsulated.
|
||||
*
|
||||
* Note that this method performs a privileged action, and callers of
|
||||
* this method should take care to ensure that the returned properties
|
||||
* are not made accessible to untrusted code since it may contain
|
||||
* sensitive information.
|
||||
*/
|
||||
public static Properties getProperties() {
|
||||
public static Properties privilegedGetProperties() {
|
||||
if (System.getSecurityManager() == null) {
|
||||
return System.getProperties();
|
||||
} else {
|
||||
|
@ -70,7 +70,7 @@ public class DSAKeyFactory extends KeyFactorySpi {
|
||||
* By default this is false.
|
||||
* This incompatibility was introduced by 4532506.
|
||||
*/
|
||||
String prop = GetPropertyAction.getProperty(SERIAL_PROP);
|
||||
String prop = GetPropertyAction.privilegedGetProperty(SERIAL_PROP);
|
||||
SERIAL_INTEROP = "true".equalsIgnoreCase(prop);
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,6 @@ import javax.security.auth.x500.X500Principal;
|
||||
|
||||
import static sun.security.provider.certpath.OCSP.*;
|
||||
import static sun.security.provider.certpath.PKIX.*;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
import sun.security.x509.*;
|
||||
import static sun.security.x509.PKIXExtensions.*;
|
||||
import sun.security.util.Debug;
|
||||
|
@ -84,7 +84,7 @@ public final class RSAKeyFactory extends KeyFactorySpi {
|
||||
public static final int MAX_RESTRICTED_EXPLEN = 64;
|
||||
|
||||
private static final boolean restrictExpLen =
|
||||
"true".equalsIgnoreCase(GetPropertyAction.getProperty(
|
||||
"true".equalsIgnoreCase(GetPropertyAction.privilegedGetProperty(
|
||||
"sun.security.rsa.restrictRSAExponent", "true"));
|
||||
|
||||
// instance used for static translateKey();
|
||||
|
@ -50,7 +50,7 @@ public interface ClientKeyExchangeService {
|
||||
providers = new HashMap<>();
|
||||
|
||||
static {
|
||||
String path = GetPropertyAction.getProperty("java.home");
|
||||
String path = GetPropertyAction.privilegedGetProperty("java.home");
|
||||
ServiceLoader<ClientKeyExchangeService> sc =
|
||||
AccessController.doPrivileged(
|
||||
(PrivilegedAction<ServiceLoader<ClientKeyExchangeService>>)
|
||||
|
@ -45,7 +45,7 @@ public class Debug {
|
||||
private static String args;
|
||||
|
||||
static {
|
||||
args = GetPropertyAction.getProperty("javax.net.debug", "");
|
||||
args = GetPropertyAction.privilegedGetProperty("javax.net.debug", "");
|
||||
args = args.toLowerCase(Locale.ENGLISH);
|
||||
if (args.equals("help")) {
|
||||
Help();
|
||||
@ -178,11 +178,11 @@ public class Debug {
|
||||
/**
|
||||
* Return the value of the boolean System property propName.
|
||||
*
|
||||
* Note use of doPrivileged(). Do make accessible to applications.
|
||||
* Note use of privileged action. Do NOT make accessible to applications.
|
||||
*/
|
||||
static boolean getBooleanProperty(String propName, boolean defaultValue) {
|
||||
// if set, require value of either true or false
|
||||
String b = GetPropertyAction.getProperty(propName);
|
||||
String b = GetPropertyAction.privilegedGetProperty(propName);
|
||||
if (b == null) {
|
||||
return defaultValue;
|
||||
} else if (b.equalsIgnoreCase("false")) {
|
||||
|
@ -656,7 +656,8 @@ public abstract class SSLContextImpl extends SSLContextSpi {
|
||||
// the provider service. Instead, please handle the initialization
|
||||
// exception in the caller's constructor.
|
||||
static {
|
||||
String property = GetPropertyAction.getProperty(PROPERTY_NAME);
|
||||
String property = GetPropertyAction
|
||||
.privilegedGetProperty(PROPERTY_NAME);
|
||||
if (property != null && property.length() != 0) {
|
||||
// remove double quote marks from beginning/end of the property
|
||||
if (property.length() > 1 && property.charAt(0) == '"' &&
|
||||
|
@ -119,8 +119,8 @@ final class ServerHandshaker extends Handshaker {
|
||||
private long statusRespTimeout;
|
||||
|
||||
static {
|
||||
String property =
|
||||
GetPropertyAction.getProperty("jdk.tls.ephemeralDHKeySize");
|
||||
String property = GetPropertyAction
|
||||
.privilegedGetProperty("jdk.tls.ephemeralDHKeySize");
|
||||
if (property == null || property.length() == 0) {
|
||||
useLegacyEphemeralDHKeys = false;
|
||||
useSmartEphemeralDHKeys = false;
|
||||
|
@ -73,8 +73,8 @@ final class StatusResponseManager {
|
||||
DEFAULT_CACHE_LIFETIME));
|
||||
cacheLifetime = life > 0 ? life : 0;
|
||||
|
||||
String uriStr =
|
||||
GetPropertyAction.getProperty("jdk.tls.stapling.responderURI");
|
||||
String uriStr = GetPropertyAction
|
||||
.privilegedGetProperty("jdk.tls.stapling.responderURI");
|
||||
URI tmpURI;
|
||||
try {
|
||||
tmpURI = ((uriStr != null && !uriStr.isEmpty()) ?
|
||||
|
@ -43,10 +43,10 @@ public class Debug {
|
||||
private static String args;
|
||||
|
||||
static {
|
||||
args = GetPropertyAction.getProperty("java.security.debug");
|
||||
args = GetPropertyAction.privilegedGetProperty("java.security.debug");
|
||||
|
||||
String args2 =
|
||||
GetPropertyAction.getProperty("java.security.auth.debug");
|
||||
String args2 = GetPropertyAction
|
||||
.privilegedGetProperty("java.security.auth.debug");
|
||||
|
||||
if (args == null) {
|
||||
args = args2;
|
||||
|
@ -144,7 +144,7 @@ public class LocalGregorianCalendar extends BaseCalendar {
|
||||
|
||||
// Append an era to the predefined eras if it's given by the property.
|
||||
String prop = GetPropertyAction
|
||||
.getProperty("jdk.calendar.japanese.supplemental.era");
|
||||
.privilegedGetProperty("jdk.calendar.japanese.supplemental.era");
|
||||
if (prop != null) {
|
||||
Era era = parseEraEntry(prop);
|
||||
if (era != null) {
|
||||
|
@ -246,7 +246,7 @@ public final class ZoneInfoFile {
|
||||
|
||||
static {
|
||||
String oldmapping = GetPropertyAction
|
||||
.getProperty("sun.timezone.ids.oldmapping", "false")
|
||||
.privilegedGetProperty("sun.timezone.ids.oldmapping", "false")
|
||||
.toLowerCase(Locale.ROOT);
|
||||
USE_OLDMAPPING = (oldmapping.equals("yes") || oldmapping.equals("true"));
|
||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
|
@ -116,7 +116,7 @@ public abstract class LocaleProviderAdapter {
|
||||
adapterCache = new ConcurrentHashMap<>();
|
||||
|
||||
static {
|
||||
String order = GetPropertyAction.getProperty("java.locale.providers");
|
||||
String order = GetPropertyAction.privilegedGetProperty("java.locale.providers");
|
||||
List<Type> typeList = new ArrayList<>();
|
||||
|
||||
// Check user specified adapter preference
|
||||
|
@ -42,7 +42,7 @@ class SolarisFileSystem extends UnixFileSystem {
|
||||
super(provider, dir);
|
||||
|
||||
// check os.version
|
||||
String osversion = GetPropertyAction.getProperty("os.version");
|
||||
String osversion = GetPropertyAction.privilegedGetProperty("os.version");
|
||||
String[] vers = Util.split(osversion, '.');
|
||||
assert vers.length >= 2;
|
||||
int majorVersion = Integer.parseInt(vers[0]);
|
||||
|
@ -85,7 +85,7 @@ public class SolarisFileSystemProvider extends UnixFileSystemProvider {
|
||||
@Override
|
||||
FileTypeDetector getFileTypeDetector() {
|
||||
Path userMimeTypes = Paths.get(
|
||||
GetPropertyAction.getProperty("user.home"), ".mime.types");
|
||||
GetPropertyAction.privilegedGetProperty("user.home"), ".mime.types");
|
||||
Path etcMimeTypes = Paths.get("/etc/mime.types");
|
||||
|
||||
return chain(new GioFileTypeDetector(),
|
||||
|
@ -36,7 +36,7 @@ class UnixFileSystem extends FileSystem {
|
||||
private final String javaHome;
|
||||
|
||||
public UnixFileSystem() {
|
||||
Properties props = GetPropertyAction.getProperties();
|
||||
Properties props = GetPropertyAction.privilegedGetProperties();
|
||||
slash = props.getProperty("file.separator").charAt(0);
|
||||
colon = props.getProperty("path.separator").charAt(0);
|
||||
javaHome = props.getProperty("java.home");
|
||||
|
@ -125,7 +125,7 @@ final class ProcessImpl extends Process {
|
||||
}
|
||||
|
||||
String helperPath() {
|
||||
Properties props = GetPropertyAction.getProperties();
|
||||
Properties props = GetPropertyAction.privilegedGetProperties();
|
||||
return helperPath(props.getProperty("java.home"),
|
||||
props.getProperty("os.arch"));
|
||||
}
|
||||
@ -159,7 +159,7 @@ final class ProcessImpl extends Process {
|
||||
}
|
||||
|
||||
static Platform get() {
|
||||
String osName = GetPropertyAction.getProperty("os.name");
|
||||
String osName = GetPropertyAction.privilegedGetProperty("os.name");
|
||||
|
||||
if (osName.equals("Linux")) { return LINUX; }
|
||||
if (osName.contains("OS X")) { return BSD; }
|
||||
|
@ -40,7 +40,7 @@ class DefaultDatagramSocketImplFactory {
|
||||
static {
|
||||
String prefix = null;
|
||||
try {
|
||||
prefix = GetPropertyAction.getProperty("impl.prefix", null);
|
||||
prefix = GetPropertyAction.privilegedGetProperty("impl.prefix");
|
||||
if (prefix != null)
|
||||
prefixImplClass = Class.forName("java.net."+prefix+"DatagramSocketImpl");
|
||||
} catch (Exception e) {
|
||||
|
@ -28,9 +28,6 @@ package sun.net;
|
||||
import java.net.InetAddress;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.IOException;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
/**
|
||||
* Defines static methods to be invoked prior to binding or connecting TCP sockets.
|
||||
|
@ -55,8 +55,9 @@ public class SdpProvider extends NetHooks.Provider {
|
||||
private PrintStream log;
|
||||
|
||||
public SdpProvider() {
|
||||
Properties props = GetPropertyAction.privilegedGetProperties();
|
||||
// if this property is not defined then there is nothing to do.
|
||||
String file = GetPropertyAction.getProperty("com.sun.sdp.conf");
|
||||
String file = props.getProperty("com.sun.sdp.conf");
|
||||
if (file == null) {
|
||||
this.enabled = false;
|
||||
this.rules = null;
|
||||
@ -65,17 +66,15 @@ public class SdpProvider extends NetHooks.Provider {
|
||||
|
||||
// load configuration file
|
||||
List<Rule> list = null;
|
||||
if (file != null) {
|
||||
try {
|
||||
list = loadRulesFromFile(file);
|
||||
} catch (IOException e) {
|
||||
fail("Error reading %s: %s", file, e.getMessage());
|
||||
}
|
||||
try {
|
||||
list = loadRulesFromFile(file);
|
||||
} catch (IOException e) {
|
||||
fail("Error reading %s: %s", file, e.getMessage());
|
||||
}
|
||||
|
||||
// check if debugging is enabled
|
||||
PrintStream out = null;
|
||||
String logfile = GetPropertyAction.getProperty("com.sun.sdp.debug");
|
||||
String logfile = props.getProperty("com.sun.sdp.debug");
|
||||
if (logfile != null) {
|
||||
out = System.out;
|
||||
if (logfile.length() > 0) {
|
||||
|
@ -76,7 +76,7 @@ public class NTLMAuthentication extends AuthenticationInfo {
|
||||
private String hostname;
|
||||
/* Domain to use if not specified by user */
|
||||
private static String defaultDomain =
|
||||
GetPropertyAction.getProperty("http.auth.ntlm.domain", "");
|
||||
GetPropertyAction.privilegedGetProperty("http.auth.ntlm.domain", "");
|
||||
|
||||
public static boolean supportsTransparentAuth () {
|
||||
return false;
|
||||
@ -141,7 +141,7 @@ public class NTLMAuthentication extends AuthenticationInfo {
|
||||
password = pw.getPassword();
|
||||
init0();
|
||||
try {
|
||||
String version = GetPropertyAction.getProperty("ntlm.version");
|
||||
String version = GetPropertyAction.privilegedGetProperty("ntlm.version");
|
||||
client = new Client(version, hostname, username, ntdomain, password);
|
||||
} catch (NTLMException ne) {
|
||||
try {
|
||||
|
@ -59,7 +59,7 @@ public class DefaultAsynchronousChannelProvider {
|
||||
* Returns the default AsynchronousChannelProvider.
|
||||
*/
|
||||
public static AsynchronousChannelProvider create() {
|
||||
String osname = GetPropertyAction.getProperty("os.name");
|
||||
String osname = GetPropertyAction.privilegedGetProperty("os.name");
|
||||
if (osname.equals("SunOS"))
|
||||
return createProvider("sun.nio.ch.SolarisAsynchronousChannelProvider");
|
||||
if (osname.equals("Linux"))
|
||||
|
@ -46,8 +46,8 @@ class UnixAsynchronousSocketChannelImpl
|
||||
|
||||
private static final boolean disableSynchronousRead;
|
||||
static {
|
||||
String propValue = GetPropertyAction
|
||||
.getProperty("sun.nio.ch.disableSynchronousRead", "false");
|
||||
String propValue = GetPropertyAction.privilegedGetProperty(
|
||||
"sun.nio.ch.disableSynchronousRead", "false");
|
||||
disableSynchronousRead = (propValue.length() == 0) ?
|
||||
true : Boolean.valueOf(propValue);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class DefaultFileSystemProvider {
|
||||
* Returns the default FileSystemProvider.
|
||||
*/
|
||||
public static FileSystemProvider create() {
|
||||
String osname = GetPropertyAction.getProperty("os.name");
|
||||
String osname = GetPropertyAction.privilegedGetProperty("os.name");
|
||||
if (osname.equals("SunOS"))
|
||||
return createProvider("sun.nio.fs.SolarisFileSystemProvider");
|
||||
if (osname.equals("Linux"))
|
||||
|
@ -57,7 +57,7 @@ abstract class UnixFileSystem
|
||||
// process working directory then paths must be resolved against the
|
||||
// default directory.
|
||||
String propValue = GetPropertyAction
|
||||
.getProperty("sun.nio.fs.chdirAllowed", "false");
|
||||
.privilegedGetProperty("sun.nio.fs.chdirAllowed", "false");
|
||||
boolean chdirAllowed = (propValue.length() == 0) ?
|
||||
true : Boolean.valueOf(propValue);
|
||||
if (chdirAllowed) {
|
||||
|
@ -42,7 +42,7 @@ class WinNTFileSystem extends FileSystem {
|
||||
private final char semicolon;
|
||||
|
||||
public WinNTFileSystem() {
|
||||
Properties props = GetPropertyAction.getProperties();
|
||||
Properties props = GetPropertyAction.privilegedGetProperties();
|
||||
slash = props.getProperty("file.separator").charAt(0);
|
||||
semicolon = props.getProperty("path.separator").charAt(0);
|
||||
altSlash = (this.slash == '\\') ? '/' : '\\';
|
||||
|
@ -56,7 +56,7 @@ class DefaultDatagramSocketImplFactory
|
||||
static {
|
||||
Class<?> prefixImplClassLocal = null;
|
||||
|
||||
Properties props = GetPropertyAction.getProperties();
|
||||
Properties props = GetPropertyAction.privilegedGetProperties();
|
||||
preferIPv4Stack = Boolean.parseBoolean(
|
||||
props.getProperty("java.net.preferIPv4Stack"));
|
||||
|
||||
|
@ -53,8 +53,8 @@ public class NTLMAuthentication extends AuthenticationInfo {
|
||||
private static String defaultDomain; /* Domain to use if not specified by user */
|
||||
|
||||
static {
|
||||
defaultDomain = GetPropertyAction.getProperty("http.auth.ntlm.domain",
|
||||
"domain");
|
||||
defaultDomain = GetPropertyAction
|
||||
.privilegedGetProperty("http.auth.ntlm.domain", "domain");
|
||||
};
|
||||
|
||||
private void init0() {
|
||||
|
@ -120,7 +120,7 @@ class FileDispatcherImpl extends FileDispatcher {
|
||||
|
||||
static boolean isFastFileTransferRequested() {
|
||||
String fileTransferProp = GetPropertyAction
|
||||
.getProperty("jdk.nio.enableFastFileTransfer");
|
||||
.privilegedGetProperty("jdk.nio.enableFastFileTransfer");
|
||||
boolean enable;
|
||||
if ("".equals(fileTransferProp)) {
|
||||
enable = true;
|
||||
|
@ -114,8 +114,8 @@ class WindowsFileAttributes
|
||||
// indicates if accurate metadata is required (interesting on NTFS only)
|
||||
private static final boolean ensureAccurateMetadata;
|
||||
static {
|
||||
String propValue = GetPropertyAction
|
||||
.getProperty("sun.nio.fs.ensureAccurateMetadata", "false");
|
||||
String propValue = GetPropertyAction.privilegedGetProperty(
|
||||
"sun.nio.fs.ensureAccurateMetadata", "false");
|
||||
ensureAccurateMetadata = (propValue.length() == 0) ?
|
||||
true : Boolean.valueOf(propValue);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user