8155775: Re-examine naming of privileged methods to access System properties
Reviewed-by: mullan
--- a/jdk/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystemProvider.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystemProvider.java Tue May 03 15:50:54 2016 +0200
@@ -102,7 +102,7 @@
@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");
--- a/jdk/src/java.base/macosx/classes/sun/nio/ch/KQueueArrayWrapper.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/macosx/classes/sun/nio/ch/KQueueArrayWrapper.java Tue May 03 15:50:54 2016 +0200
@@ -84,7 +84,8 @@
static {
IOUtil.load();
initStructSizes();
- String datamodel = GetPropertyAction.getProperty("sun.arch.data.model");
+ String datamodel =
+ GetPropertyAction.privilegedGetProperty("sun.arch.data.model");
is64bit = "64".equals(datamodel);
}
--- a/jdk/src/java.base/macosx/classes/sun/nio/fs/MacOSXFileSystem.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/macosx/classes/sun/nio/fs/MacOSXFileSystem.java Tue May 03 15:50:54 2016 +0200
@@ -29,8 +29,6 @@
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.*;
--- a/jdk/src/java.base/macosx/classes/sun/nio/fs/MacOSXFileSystemProvider.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/macosx/classes/sun/nio/fs/MacOSXFileSystemProvider.java Tue May 03 15:50:54 2016 +0200
@@ -46,8 +46,8 @@
@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());
--- a/jdk/src/java.base/share/classes/java/io/File.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/io/File.java Tue May 03 15:50:54 2016 +0200
@@ -1896,7 +1896,7 @@
// 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;
}
--- a/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java Tue May 03 15:50:54 2016 +0200
@@ -468,7 +468,7 @@
*/
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")
);
--- a/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java Tue May 03 15:50:54 2016 +0200
@@ -78,7 +78,8 @@
* 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 @@
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;
- }
}
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java Tue May 03 15:50:54 2016 +0200
@@ -88,7 +88,7 @@
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);
}
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java Tue May 03 15:50:54 2016 +0200
@@ -53,7 +53,7 @@
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(
--- a/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java Tue May 03 15:50:54 2016 +0200
@@ -197,7 +197,7 @@
// 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(
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java Tue May 03 15:50:54 2016 +0200
@@ -582,7 +582,7 @@
}
private static final String DEBUG =
- GetPropertyAction.getProperty("jdk.proxy.debug", "");
+ GetPropertyAction.privilegedGetProperty("jdk.proxy.debug", "");
private static boolean isDebug() {
return !DEBUG.isEmpty();
--- a/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java Tue May 03 15:50:54 2016 +0200
@@ -52,7 +52,8 @@
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
--- a/jdk/src/java.base/share/classes/java/net/InetAddress.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/net/InetAddress.java Tue May 03 15:50:54 2016 +0200
@@ -1124,7 +1124,7 @@
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 @@
* 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) {
--- a/jdk/src/java.base/share/classes/java/net/SocksSocketImpl.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/net/SocksSocketImpl.java Tue May 03 15:50:54 2016 +0200
@@ -178,7 +178,7 @@
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 @@
userName = System.getProperty("user.name");
} catch (SecurityException se) { /* swallow Exception */ }
} else {
- userName = GetPropertyAction.getProperty("user.name");
+ userName = GetPropertyAction.privilegedGetProperty("user.name");
}
return userName;
}
--- a/jdk/src/java.base/share/classes/java/net/URL.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/net/URL.java Tue May 03 15:50:54 2016 +0200
@@ -1212,7 +1212,7 @@
private static URLStreamHandler lookupViaProperty(String protocol) {
String packagePrefixList =
- GetPropertyAction.getProperty(protocolPathProp);
+ GetPropertyAction.privilegedGetProperty(protocolPathProp);
if (packagePrefixList == null) {
// not set
return null;
--- a/jdk/src/java.base/share/classes/java/net/URLConnection.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/net/URLConnection.java Tue May 03 15:50:54 2016 +0200
@@ -1397,7 +1397,7 @@
*/
private String getContentHandlerPkgPrefixes() {
String packagePrefixList =
- GetPropertyAction.getProperty(contentPathProp, "");
+ GetPropertyAction.privilegedGetProperty(contentPathProp, "");
if (packagePrefixList != "") {
packagePrefixList += "|";
--- a/jdk/src/java.base/share/classes/java/net/URLEncoder.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/net/URLEncoder.java Tue May 03 15:50:54 2016 +0200
@@ -133,7 +133,7 @@
dontNeedEncoding.set('.');
dontNeedEncoding.set('*');
- dfltEncName = GetPropertyAction.getProperty("file.encoding");
+ dfltEncName = GetPropertyAction.privilegedGetProperty("file.encoding");
}
/**
--- a/jdk/src/java.base/share/classes/java/nio/charset/Charset.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/nio/charset/Charset.java Tue May 03 15:50:54 2016 +0200
@@ -283,8 +283,8 @@
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 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;
--- a/jdk/src/java.base/share/classes/java/nio/file/TempFileHelper.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/nio/file/TempFileHelper.java Tue May 03 15:50:54 2016 +0200
@@ -46,7 +46,7 @@
// 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");
--- a/jdk/src/java.base/share/classes/java/util/Locale.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/util/Locale.java Tue May 03 15:50:54 2016 +0200
@@ -858,7 +858,7 @@
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 @@
}
private static Locale initDefault(Locale.Category category) {
- Properties props = GetPropertyAction.getProperties();
+ Properties props = GetPropertyAction.privilegedGetProperties();
return getInstance(
props.getProperty(category.languageKey,
defaultLocale.getLanguage()),
--- a/jdk/src/java.base/share/classes/java/util/PropertyResourceBundle.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/util/PropertyResourceBundle.java Tue May 03 15:50:54 2016 +0200
@@ -140,9 +140,8 @@
// 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);
/**
--- a/jdk/src/java.base/share/classes/java/util/TimeZone.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/util/TimeZone.java Tue May 03 15:50:54 2016 +0200
@@ -42,6 +42,7 @@
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 @@
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 @@
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;
--- a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java Tue May 03 15:50:54 2016 +0200
@@ -155,7 +155,7 @@
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 @@
}
RUNTIME_VERSION = runtimeVersion;
String enableMultiRelease = GetPropertyAction
- .getProperty("jdk.util.jar.enableMultiRelease", "true");
+ .privilegedGetProperty("jdk.util.jar.enableMultiRelease", "true");
switch (enableMultiRelease) {
case "true":
default:
--- a/jdk/src/java.base/share/classes/java/util/jar/Pack200.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/util/jar/Pack200.java Tue May 03 15:50:54 2016 +0200
@@ -695,7 +695,7 @@
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))
--- a/jdk/src/java.base/share/classes/java/util/regex/PatternSyntaxException.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/util/regex/PatternSyntaxException.java Tue May 03 15:50:54 2016 +0200
@@ -94,7 +94,7 @@
}
private static final String nl =
- GetPropertyAction.getProperty("line.separator");
+ GetPropertyAction.privilegedGetProperty("line.separator");
/**
* Returns a multi-line string containing the description of the syntax
--- a/jdk/src/java.base/share/classes/java/util/zip/ZipOutputStream.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/util/zip/ZipOutputStream.java Tue May 03 15:50:54 2016 +0200
@@ -55,7 +55,7 @@
*/
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;
--- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java Tue May 03 15:50:54 2016 +0200
@@ -51,7 +51,7 @@
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");
--- a/jdk/src/java.base/share/classes/jdk/Version.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/jdk/Version.java Tue May 03 15:50:54 2016 +0200
@@ -273,7 +273,8 @@
*/
public static Version current() {
if (current == null) {
- current = parse(GetPropertyAction.getProperty("java.version"));
+ current = parse(
+ GetPropertyAction.privilegedGetProperty("java.version"));
}
return current;
}
--- a/jdk/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java Tue May 03 15:50:54 2016 +0200
@@ -85,7 +85,7 @@
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");
--- a/jdk/src/java.base/share/classes/jdk/internal/logger/LoggerFinderLoader.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/jdk/internal/logger/LoggerFinderLoader.java Tue May 03 15:50:54 2016 +0200
@@ -81,7 +81,7 @@
// 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 @@
// 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() {
--- a/jdk/src/java.base/share/classes/jdk/internal/logger/SimpleConsoleLogger.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/jdk/internal/logger/SimpleConsoleLogger.java Tue May 03 15:50:54 2016 +0200
@@ -56,7 +56,7 @@
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 @@
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 @@
// 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);
--- a/jdk/src/java.base/share/classes/jdk/internal/reflect/Reflection.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/Reflection.java Tue May 03 15:50:54 2016 +0200
@@ -343,8 +343,8 @@
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;
--- a/jdk/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java Tue May 03 15:50:54 2016 +0200
@@ -398,7 +398,7 @@
return;
}
- Properties props = GetPropertyAction.getProperties();
+ Properties props = GetPropertyAction.privilegedGetProperties();
String val = props.getProperty("sun.reflect.noInflation");
if (val != null && val.equals("true")) {
noInflation = true;
--- a/jdk/src/java.base/share/classes/sun/net/ResourceManager.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/net/ResourceManager.java Tue May 03 15:50:54 2016 +0200
@@ -53,8 +53,8 @@
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) {
--- a/jdk/src/java.base/share/classes/sun/net/sdp/SdpSupport.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/net/sdp/SdpSupport.java Tue May 03 15:50:54 2016 +0200
@@ -40,7 +40,7 @@
*/
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();
--- a/jdk/src/java.base/share/classes/sun/net/smtp/SmtpClient.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/net/smtp/SmtpClient.java Tue May 03 15:50:54 2016 +0200
@@ -157,7 +157,7 @@
}
try {
String s;
- mailhost = GetPropertyAction.getProperty("mail.host");
+ mailhost = GetPropertyAction.privilegedGetProperty("mail.host");
if (mailhost != null) {
openServer(mailhost);
return;
@@ -183,7 +183,7 @@
setConnectTimeout(to);
try {
String s;
- mailhost = GetPropertyAction.getProperty("mail.host");
+ mailhost = GetPropertyAction.privilegedGetProperty("mail.host");
if (mailhost != null) {
openServer(mailhost);
return;
--- a/jdk/src/java.base/share/classes/sun/net/www/MimeLauncher.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/net/www/MimeLauncher.java Tue May 03 15:50:54 2016 +0200
@@ -183,7 +183,7 @@
}
String execPathList;
- execPathList = GetPropertyAction.getProperty("exec.path");
+ execPathList = GetPropertyAction.privilegedGetProperty("exec.path");
if (execPathList == null) {
// exec.path property not set
return false;
--- a/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java Tue May 03 15:50:54 2016 +0200
@@ -145,7 +145,7 @@
}
static {
- Properties props = GetPropertyAction.getProperties();
+ Properties props = GetPropertyAction.privilegedGetProperties();
String keepAlive = props.getProperty("http.keepAlive");
String retryPost = props.getProperty("sun.net.http.retryPost");
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java Tue May 03 15:50:54 2016 +0200
@@ -278,7 +278,7 @@
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 + "@");
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationHeader.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationHeader.java Tue May 03 15:50:54 2016 +0200
@@ -94,7 +94,7 @@
}
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
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Tue May 03 15:50:54 2016 +0200
@@ -207,9 +207,9 @@
};
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 @@
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
}
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java Tue May 03 15:50:54 2016 +0200
@@ -139,7 +139,7 @@
//
String ciphers [];
String cipherString =
- GetPropertyAction.getProperty("https.cipherSuites");
+ GetPropertyAction.privilegedGetProperty("https.cipherSuites");
if (cipherString == null || "".equals(cipherString)) {
ciphers = null;
@@ -163,7 +163,7 @@
//
String protocols [];
String protocolString =
- GetPropertyAction.getProperty("https.protocols");
+ GetPropertyAction.privilegedGetProperty("https.protocols");
if (protocolString == null || "".equals(protocolString)) {
protocols = null;
@@ -183,7 +183,8 @@
}
private String getUserAgent() {
- String userAgent = GetPropertyAction.getProperty("https.agent");
+ String userAgent =
+ GetPropertyAction.privilegedGetProperty("https.agent");
if (userAgent == null || userAgent.length() == 0) {
userAgent = "JSSE";
}
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java Tue May 03 15:50:54 2016 +0200
@@ -161,7 +161,7 @@
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;
}
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/netdoc/Handler.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/netdoc/Handler.java Tue May 03 15:50:54 2016 +0200
@@ -56,9 +56,9 @@
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) {
--- a/jdk/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java Tue May 03 15:50:54 2016 +0200
@@ -1019,7 +1019,7 @@
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;
--- a/jdk/src/java.base/share/classes/sun/nio/ch/Net.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/Net.java Tue May 03 15:50:54 2016 +0200
@@ -374,8 +374,8 @@
}
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 @@
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);
--- a/jdk/src/java.base/share/classes/sun/nio/ch/Util.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/Util.java Tue May 03 15:50:54 2016 +0200
@@ -64,7 +64,8 @@
* 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 @@
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);
--- a/jdk/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template Tue May 03 15:50:54 2016 +0200
@@ -164,7 +164,7 @@
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 @@
}
}
- private static String getProperty(String key) {
- return GetPropertyAction.getProperty(key);
- }
-
-
}
--- a/jdk/src/java.base/share/classes/sun/nio/fs/Util.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/nio/fs/Util.java Tue May 03 15:50:54 2016 +0200
@@ -38,7 +38,7 @@
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
--- a/jdk/src/java.base/share/classes/sun/security/action/GetIntegerAction.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/security/action/GetIntegerAction.java Tue May 03 15:50:54 2016 +0200
@@ -118,9 +118,14 @@
* 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 @@
* 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);
--- a/jdk/src/java.base/share/classes/sun/security/action/GetPropertyAction.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/security/action/GetPropertyAction.java Tue May 03 15:50:54 2016 +0200
@@ -93,9 +93,14 @@
* 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 @@
* 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 @@
* 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 {
--- a/jdk/src/java.base/share/classes/sun/security/provider/DSAKeyFactory.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/security/provider/DSAKeyFactory.java Tue May 03 15:50:54 2016 +0200
@@ -70,7 +70,7 @@
* 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);
}
--- a/jdk/src/java.base/share/classes/sun/security/provider/certpath/RevocationChecker.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/RevocationChecker.java Tue May 03 15:50:54 2016 +0200
@@ -43,7 +43,6 @@
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;
--- a/jdk/src/java.base/share/classes/sun/security/rsa/RSAKeyFactory.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/security/rsa/RSAKeyFactory.java Tue May 03 15:50:54 2016 +0200
@@ -84,7 +84,7 @@
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();
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ClientKeyExchangeService.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ClientKeyExchangeService.java Tue May 03 15:50:54 2016 +0200
@@ -50,7 +50,7 @@
providers = new HashMap<>();
static {
- String path = GetPropertyAction.getProperty("java.home");
+ String path = GetPropertyAction.privilegedGetProperty("java.home");
ServiceLoader<ClientKeyExchangeService> sc =
AccessController.doPrivileged(
(PrivilegedAction<ServiceLoader<ClientKeyExchangeService>>)
--- a/jdk/src/java.base/share/classes/sun/security/ssl/Debug.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/Debug.java Tue May 03 15:50:54 2016 +0200
@@ -45,7 +45,7 @@
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 @@
/**
* 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")) {
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java Tue May 03 15:50:54 2016 +0200
@@ -656,7 +656,8 @@
// 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) == '"' &&
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java Tue May 03 15:50:54 2016 +0200
@@ -119,8 +119,8 @@
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;
--- a/jdk/src/java.base/share/classes/sun/security/ssl/StatusResponseManager.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/StatusResponseManager.java Tue May 03 15:50:54 2016 +0200
@@ -73,8 +73,8 @@
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()) ?
--- a/jdk/src/java.base/share/classes/sun/security/util/Debug.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/security/util/Debug.java Tue May 03 15:50:54 2016 +0200
@@ -43,10 +43,10 @@
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;
--- a/jdk/src/java.base/share/classes/sun/util/calendar/LocalGregorianCalendar.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/util/calendar/LocalGregorianCalendar.java Tue May 03 15:50:54 2016 +0200
@@ -144,7 +144,7 @@
// 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) {
--- a/jdk/src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java Tue May 03 15:50:54 2016 +0200
@@ -246,7 +246,7 @@
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>() {
--- a/jdk/src/java.base/share/classes/sun/util/locale/provider/LocaleProviderAdapter.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/util/locale/provider/LocaleProviderAdapter.java Tue May 03 15:50:54 2016 +0200
@@ -116,7 +116,7 @@
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
--- a/jdk/src/java.base/solaris/classes/sun/nio/fs/SolarisFileSystem.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/solaris/classes/sun/nio/fs/SolarisFileSystem.java Tue May 03 15:50:54 2016 +0200
@@ -42,7 +42,7 @@
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]);
--- a/jdk/src/java.base/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java Tue May 03 15:50:54 2016 +0200
@@ -85,7 +85,7 @@
@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(),
--- a/jdk/src/java.base/unix/classes/java/io/UnixFileSystem.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/unix/classes/java/io/UnixFileSystem.java Tue May 03 15:50:54 2016 +0200
@@ -36,7 +36,7 @@
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");
--- a/jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java Tue May 03 15:50:54 2016 +0200
@@ -125,7 +125,7 @@
}
String helperPath() {
- Properties props = GetPropertyAction.getProperties();
+ Properties props = GetPropertyAction.privilegedGetProperties();
return helperPath(props.getProperty("java.home"),
props.getProperty("os.arch"));
}
@@ -159,7 +159,7 @@
}
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; }
--- a/jdk/src/java.base/unix/classes/java/net/DefaultDatagramSocketImplFactory.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/unix/classes/java/net/DefaultDatagramSocketImplFactory.java Tue May 03 15:50:54 2016 +0200
@@ -40,7 +40,7 @@
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) {
--- a/jdk/src/java.base/unix/classes/sun/net/NetHooks.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/unix/classes/sun/net/NetHooks.java Tue May 03 15:50:54 2016 +0200
@@ -28,9 +28,6 @@
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.
--- a/jdk/src/java.base/unix/classes/sun/net/sdp/SdpProvider.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/unix/classes/sun/net/sdp/SdpProvider.java Tue May 03 15:50:54 2016 +0200
@@ -55,8 +55,9 @@
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 @@
// 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) {
--- a/jdk/src/java.base/unix/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/unix/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java Tue May 03 15:50:54 2016 +0200
@@ -76,7 +76,7 @@
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 @@
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 {
--- a/jdk/src/java.base/unix/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/unix/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java Tue May 03 15:50:54 2016 +0200
@@ -59,7 +59,7 @@
* 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"))
--- a/jdk/src/java.base/unix/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/unix/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java Tue May 03 15:50:54 2016 +0200
@@ -46,8 +46,8 @@
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);
}
--- a/jdk/src/java.base/unix/classes/sun/nio/fs/DefaultFileSystemProvider.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/unix/classes/sun/nio/fs/DefaultFileSystemProvider.java Tue May 03 15:50:54 2016 +0200
@@ -54,7 +54,7 @@
* 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"))
--- a/jdk/src/java.base/unix/classes/sun/nio/fs/UnixFileSystem.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/unix/classes/sun/nio/fs/UnixFileSystem.java Tue May 03 15:50:54 2016 +0200
@@ -57,7 +57,7 @@
// 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) {
--- a/jdk/src/java.base/windows/classes/java/io/WinNTFileSystem.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/windows/classes/java/io/WinNTFileSystem.java Tue May 03 15:50:54 2016 +0200
@@ -42,7 +42,7 @@
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 == '\\') ? '/' : '\\';
--- a/jdk/src/java.base/windows/classes/java/net/DefaultDatagramSocketImplFactory.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/windows/classes/java/net/DefaultDatagramSocketImplFactory.java Tue May 03 15:50:54 2016 +0200
@@ -56,7 +56,7 @@
static {
Class<?> prefixImplClassLocal = null;
- Properties props = GetPropertyAction.getProperties();
+ Properties props = GetPropertyAction.privilegedGetProperties();
preferIPv4Stack = Boolean.parseBoolean(
props.getProperty("java.net.preferIPv4Stack"));
--- a/jdk/src/java.base/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java Tue May 03 15:50:54 2016 +0200
@@ -53,8 +53,8 @@
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() {
--- a/jdk/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java Tue May 03 15:50:54 2016 +0200
@@ -120,7 +120,7 @@
static boolean isFastFileTransferRequested() {
String fileTransferProp = GetPropertyAction
- .getProperty("jdk.nio.enableFastFileTransfer");
+ .privilegedGetProperty("jdk.nio.enableFastFileTransfer");
boolean enable;
if ("".equals(fileTransferProp)) {
enable = true;
--- a/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsFileAttributes.java Tue May 03 11:45:56 2016 +0100
+++ b/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsFileAttributes.java Tue May 03 15:50:54 2016 +0200
@@ -114,8 +114,8 @@
// 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);
}