8035808: Eliminate dependency to GetPropertyAction and other sun.security.action convenient classes
Reviewed-by: alanb, chegar
--- a/jdk/src/share/classes/com/sun/tracing/ProviderFactory.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/com/sun/tracing/ProviderFactory.java Fri Mar 07 13:00:25 2014 -0800
@@ -5,9 +5,9 @@
import java.io.PrintStream;
import java.lang.reflect.Field;
import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
-import sun.security.action.GetPropertyAction;
import sun.tracing.NullProviderFactory;
import sun.tracing.PrintStreamProviderFactory;
@@ -56,7 +56,7 @@
// Try to instantiate a DTraceProviderFactory
String prop = AccessController.doPrivileged(
- new GetPropertyAction("com.sun.tracing.dtrace"));
+ (PrivilegedAction<String>) () -> System.getProperty("com.sun.tracing.dtrace"));
if ( (prop == null || !prop.equals("disable")) &&
DTraceProviderFactory.isSupported() ) {
@@ -65,7 +65,7 @@
// Try to instantiate an output stream factory
prop = AccessController.doPrivileged(
- new GetPropertyAction("sun.tracing.stream"));
+ (PrivilegedAction<String>) () -> System.getProperty("sun.tracing.stream"));
if (prop != null) {
for (String spec : prop.split(",")) {
PrintStream ps = getPrintStreamFromSpec(spec);
--- a/jdk/src/share/classes/java/rmi/activation/ActivationGroup.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/java/rmi/activation/ActivationGroup.java Fri Mar 07 13:00:25 2014 -0800
@@ -36,7 +36,7 @@
import java.rmi.server.RMIClassLoader;
import java.rmi.server.UnicastRemoteObject;
import java.security.AccessController;
-import sun.security.action.GetIntegerAction;
+import java.security.PrivilegedAction;
/**
* An <code>ActivationGroup</code> is responsible for creating new
@@ -446,9 +446,8 @@
{
if (currSystem == null) {
try {
- int port = AccessController.doPrivileged(
- new GetIntegerAction("java.rmi.activation.port",
- ActivationSystem.SYSTEM_PORT));
+ int port = AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
+ Integer.getInteger("java.rmi.activation.port", ActivationSystem.SYSTEM_PORT));
currSystem = (ActivationSystem)
Naming.lookup("//:" + port +
"/java.rmi.activation.ActivationSystem");
--- a/jdk/src/share/classes/java/rmi/server/ObjID.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/java/rmi/server/ObjID.java Fri Mar 07 13:00:25 2014 -0800
@@ -31,9 +31,9 @@
import java.io.ObjectOutput;
import java.io.Serializable;
import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.security.SecureRandom;
import java.util.concurrent.atomic.AtomicLong;
-import sun.security.action.GetPropertyAction;
/**
* An <code>ObjID</code> is used to identify a remote object exported
@@ -242,7 +242,7 @@
private static boolean useRandomIDs() {
String value = AccessController.doPrivileged(
- new GetPropertyAction("java.rmi.server.randomIDs"));
+ (PrivilegedAction<String>) () -> System.getProperty("java.rmi.server.randomIDs"));
return value == null ? true : Boolean.parseBoolean(value);
}
}
--- a/jdk/src/share/classes/javax/smartcardio/TerminalFactory.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/javax/smartcardio/TerminalFactory.java Fri Mar 07 13:00:25 2014 -0800
@@ -32,8 +32,6 @@
import sun.security.jca.*;
import sun.security.jca.GetInstance.*;
-import sun.security.action.GetPropertyAction;
-
/**
* A factory for CardTerminal objects.
*
@@ -99,8 +97,8 @@
static {
// lookup up the user specified type, default to PC/SC
- String type = AccessController.doPrivileged
- (new GetPropertyAction(PROP_NAME, "PC/SC")).trim();
+ String type = AccessController.doPrivileged(
+ (PrivilegedAction<String>) () -> System.getProperty(PROP_NAME, "PC/SC")).trim();
TerminalFactory factory = null;
try {
factory = TerminalFactory.getInstance(type, null);
--- a/jdk/src/share/classes/sun/management/VMManagementImpl.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/management/VMManagementImpl.java Fri Mar 07 13:00:25 2014 -0800
@@ -37,7 +37,6 @@
import java.util.Collections;
import java.security.AccessController;
import java.security.PrivilegedAction;
-import sun.security.action.GetPropertyAction;
/**
* Implementation of VMManagement interface that accesses the management
@@ -173,10 +172,8 @@
}
public String getBootClassPath( ) {
- PrivilegedAction<String> pa
- = new GetPropertyAction("sun.boot.class.path");
- String result = AccessController.doPrivileged(pa);
- return result;
+ return AccessController.doPrivileged(
+ (PrivilegedAction<String>) () -> System.getProperty("sun.boot.class.path"));
}
public long getUptime() {
--- a/jdk/src/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java Fri Mar 07 13:00:25 2014 -0800
@@ -36,7 +36,7 @@
import sun.net.dns.ResolverConfiguration;
import sun.net.spi.nameservice.*;
import java.security.AccessController;
-import sun.security.action.*;
+import java.security.PrivilegedAction;
/*
* A name service provider based on JNDI-DNS.
@@ -231,7 +231,7 @@
// default domain
String domain = AccessController.doPrivileged(
- new GetPropertyAction("sun.net.spi.nameservice.domain"));
+ (PrivilegedAction<String>) () -> System.getProperty("sun.net.spi.nameservice.domain"));
if (domain != null && domain.length() > 0) {
domainList = new LinkedList<String>();
domainList.add(domain);
@@ -239,7 +239,7 @@
// name servers
String nameservers = AccessController.doPrivileged(
- new GetPropertyAction("sun.net.spi.nameservice.nameservers"));
+ (PrivilegedAction<String>) () -> System.getProperty("sun.net.spi.nameservice.nameservers"));
if (nameservers != null && nameservers.length() > 0) {
nameProviderUrl = createProviderURL(nameservers);
if (nameProviderUrl.length() == 0) {
--- a/jdk/src/share/classes/sun/rmi/log/ReliableLog.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/rmi/log/ReliableLog.java Fri Mar 07 13:00:25 2014 -0800
@@ -30,8 +30,6 @@
import java.rmi.server.RMIClassLoader;
import java.security.AccessController;
import java.security.PrivilegedAction;
-import sun.security.action.GetBooleanAction;
-import sun.security.action.GetPropertyAction;
/**
* This class is a simple implementation of a reliable Log. The
@@ -141,7 +139,7 @@
{
super();
this.Debug = AccessController.doPrivileged(
- new GetBooleanAction("sun.rmi.log.debug")).booleanValue();
+ (PrivilegedAction<Boolean>) () -> Boolean.getBoolean("sun.rmi.log.debug"));
dir = new File(dirPath);
if (!(dir.exists() && dir.isDirectory())) {
// create directory
@@ -334,7 +332,7 @@
getLogClassConstructor() {
String logClassName = AccessController.doPrivileged(
- new GetPropertyAction("sun.rmi.log.class"));
+ (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.log.class"));
if (logClassName != null) {
try {
ClassLoader loader =
--- a/jdk/src/share/classes/sun/rmi/runtime/Log.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/rmi/runtime/Log.java Fri Mar 07 13:00:25 2014 -0800
@@ -26,22 +26,16 @@
package sun.rmi.runtime;
import java.io.ByteArrayOutputStream;
-import java.io.IOException;
import java.io.PrintStream;
import java.io.OutputStream;
import java.rmi.server.LogStream;
-import java.util.logging.ConsoleHandler;
+import java.security.PrivilegedAction;
import java.util.logging.Handler;
-import java.util.logging.Formatter;
import java.util.logging.SimpleFormatter;
-import java.util.logging.StreamHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
-import java.util.logging.LogManager;
import java.util.logging.LogRecord;
import java.util.logging.StreamHandler;
-import java.util.Map;
-import java.util.HashMap;
/**
* Utility which provides an abstract "logger" like RMI internal API
@@ -71,10 +65,8 @@
/* selects log implementation */
private static final LogFactory logFactory;
static {
- boolean useOld =
- Boolean.valueOf(java.security.AccessController.
- doPrivileged(new sun.security.action.GetPropertyAction(
- "sun.rmi.log.useOld"))).booleanValue();
+ boolean useOld = java.security.AccessController.doPrivileged(
+ (PrivilegedAction<Boolean>) () -> Boolean.getBoolean("sun.rmi.log.useOld"));
/* set factory to select the logging facility to use */
logFactory = (useOld ? (LogFactory) new LogStreamLogFactory() :
--- a/jdk/src/share/classes/sun/rmi/runtime/RuntimeUtil.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/rmi/runtime/RuntimeUtil.java Fri Mar 07 13:00:25 2014 -0800
@@ -33,7 +33,6 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
-import sun.security.action.GetIntegerAction;
/**
* RMI runtime implementation utilities.
@@ -54,8 +53,8 @@
/** number of scheduler threads */
private static final int schedulerThreads = // default 1
- AccessController.doPrivileged(
- new GetIntegerAction("sun.rmi.runtime.schedulerThreads", 1));
+ AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
+ Integer.getInteger("sun.rmi.runtime.schedulerThreads", 1));
/** permission required to get instance */
private static final Permission GET_INSTANCE_PERMISSION =
--- a/jdk/src/share/classes/sun/rmi/server/Activation.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/rmi/server/Activation.java Fri Mar 07 13:00:25 2014 -0800
@@ -107,9 +107,6 @@
import sun.rmi.runtime.NewThreadAction;
import sun.rmi.server.UnicastServerRef;
import sun.rmi.transport.LiveRef;
-import sun.security.action.GetBooleanAction;
-import sun.security.action.GetIntegerAction;
-import sun.security.action.GetPropertyAction;
import sun.security.provider.PolicyFile;
import com.sun.rmi.rmid.ExecPermission;
import com.sun.rmi.rmid.ExecOptionPermission;
@@ -184,7 +181,8 @@
// this should be a *private* method since it is privileged
private static int getInt(String name, int def) {
- return AccessController.doPrivileged(new GetIntegerAction(name, def));
+ return AccessController.doPrivileged(
+ (PrivilegedAction<Integer>) () -> Integer.getInteger(name, def));
}
private transient Activator activator;
@@ -2042,13 +2040,13 @@
}
debugExec = AccessController.doPrivileged(
- new GetBooleanAction("sun.rmi.server.activation.debugExec"));
+ (PrivilegedAction<Boolean>) () -> Boolean.getBoolean("sun.rmi.server.activation.debugExec"));
/**
* Determine class name for activation exec policy (if any).
*/
String execPolicyClassName = AccessController.doPrivileged(
- new GetPropertyAction("sun.rmi.activation.execPolicy", null));
+ (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.activation.execPolicy"));
if (execPolicyClassName == null) {
if (!stop) {
DefaultExecPolicy.checkConfiguration();
@@ -2387,7 +2385,7 @@
static {
lineSeparator = AccessController.doPrivileged(
- new GetPropertyAction("line.separator"));
+ (PrivilegedAction<String>) () -> System.getProperty("line.separator"));
lineSeparatorLength = lineSeparator.length();
}
--- a/jdk/src/share/classes/sun/rmi/server/LoaderHandler.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/rmi/server/LoaderHandler.java Fri Mar 07 13:00:25 2014 -0800
@@ -47,6 +47,7 @@
import java.security.Policy;
import java.security.ProtectionDomain;
import java.rmi.server.LogStream;
+import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
@@ -57,7 +58,6 @@
import java.util.WeakHashMap;
import sun.reflect.misc.ReflectUtil;
import sun.rmi.runtime.Log;
-import sun.security.action.GetPropertyAction;
/**
* <code>LoaderHandler</code> provides the implementation of the static
@@ -73,7 +73,7 @@
/** RMI class loader log level */
static final int logLevel = LogStream.parseLevel(
java.security.AccessController.doPrivileged(
- new GetPropertyAction("sun.rmi.loader.logLevel")));
+ (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.loader.logLevel")));
/* loader system log */
static final Log loaderLog =
@@ -86,7 +86,7 @@
private static String codebaseProperty = null;
static {
String prop = java.security.AccessController.doPrivileged(
- new GetPropertyAction("java.rmi.server.codebase"));
+ (PrivilegedAction<String>) () -> System.getProperty("java.rmi.server.codebase"));
if (prop != null && prop.trim().length() > 0) {
codebaseProperty = prop;
}
--- a/jdk/src/share/classes/sun/rmi/server/MarshalInputStream.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/rmi/server/MarshalInputStream.java Fri Mar 07 13:00:25 2014 -0800
@@ -36,6 +36,7 @@
import java.security.Permission;
import java.rmi.server.RMIClassLoader;
+import java.security.PrivilegedAction;
/**
* MarshalInputStream is an extension of ObjectInputStream. When resolving
@@ -65,7 +66,7 @@
*/
private static final boolean useCodebaseOnlyProperty =
! java.security.AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction(
+ (PrivilegedAction<String>) () -> System.getProperty(
"java.rmi.server.useCodebaseOnly", "true"))
.equalsIgnoreCase("false");
--- a/jdk/src/share/classes/sun/rmi/server/UnicastRef.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/rmi/server/UnicastRef.java Fri Mar 07 13:00:25 2014 -0800
@@ -39,11 +39,11 @@
import java.rmi.server.RemoteObject;
import java.rmi.server.RemoteRef;
import java.security.AccessController;
+import java.security.PrivilegedAction;
import sun.rmi.runtime.Log;
import sun.rmi.transport.Connection;
import sun.rmi.transport.LiveRef;
import sun.rmi.transport.StreamRemoteCall;
-import sun.security.action.GetBooleanAction;
/**
* NOTE: There is a JDK-internal dependency on the existence of this
@@ -64,8 +64,8 @@
*/
public static final Log clientCallLog =
Log.getLog("sun.rmi.client.call", "RMI",
- AccessController.doPrivileged(
- new GetBooleanAction("sun.rmi.client.logCalls")));
+ AccessController.doPrivileged((PrivilegedAction<Boolean>) () ->
+ Boolean.getBoolean("sun.rmi.client.logCalls")));
private static final long serialVersionUID = 8258372400816541186L;
protected LiveRef ref;
--- a/jdk/src/share/classes/sun/rmi/server/UnicastServerRef.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/rmi/server/UnicastServerRef.java Fri Mar 07 13:00:25 2014 -0800
@@ -56,7 +56,6 @@
import sun.rmi.transport.LiveRef;
import sun.rmi.transport.Target;
import sun.rmi.transport.tcp.TCPTransport;
-import sun.security.action.GetBooleanAction;
/**
* UnicastServerRef implements the remote reference layer server-side
@@ -73,7 +72,7 @@
{
/** value of server call log property */
public static final boolean logCalls = AccessController.doPrivileged(
- new GetBooleanAction("java.rmi.server.logCalls"));
+ (PrivilegedAction<Boolean>) () -> Boolean.getBoolean("java.rmi.server.logCalls"));
/** server call log */
public static final Log callLog =
@@ -84,8 +83,8 @@
/** flag to enable writing exceptions to System.err */
private static final boolean wantExceptionLog =
- AccessController.doPrivileged(
- new GetBooleanAction("sun.rmi.server.exceptionTrace"));
+ AccessController.doPrivileged((PrivilegedAction<Boolean>) () ->
+ Boolean.getBoolean("sun.rmi.server.exceptionTrace"));
private boolean forceStubUse = false;
@@ -94,9 +93,8 @@
* exceptions thrown by remote invocations to this VM
*/
private static final boolean suppressStackTraces =
- AccessController.doPrivileged(
- new GetBooleanAction(
- "sun.rmi.server.suppressStackTraces"));
+ AccessController.doPrivileged((PrivilegedAction<Boolean>) () ->
+ Boolean.getBoolean("sun.rmi.server.suppressStackTraces"));
/**
* skeleton to dispatch remote calls through, for 1.1 stub protocol
--- a/jdk/src/share/classes/sun/rmi/server/Util.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/rmi/server/Util.java Fri Mar 07 13:00:25 2014 -0800
@@ -57,8 +57,6 @@
import sun.rmi.runtime.Log;
import sun.rmi.transport.LiveRef;
import sun.rmi.transport.tcp.TCPEndpoint;
-import sun.security.action.GetBooleanAction;
-import sun.security.action.GetPropertyAction;
/**
* A utility class with static methods for creating stubs/proxies and
@@ -70,7 +68,7 @@
/** "server" package log level */
static final int logLevel = LogStream.parseLevel(
AccessController.doPrivileged(
- new GetPropertyAction("sun.rmi.server.logLevel")));
+ (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.server.logLevel")));
/** server reference log */
public static final Log serverRefLog =
@@ -79,8 +77,7 @@
/** cached value of property java.rmi.server.ignoreStubClasses */
private static final boolean ignoreStubClasses =
AccessController.doPrivileged(
- new GetBooleanAction("java.rmi.server.ignoreStubClasses")).
- booleanValue();
+ (PrivilegedAction<Boolean>) () -> Boolean.getBoolean("java.rmi.server.ignoreStubClasses"));
/** cache of impl classes that have no corresponding stub class */
private static final Map<Class<?>, Void> withoutStubs =
--- a/jdk/src/share/classes/sun/rmi/transport/DGCAckHandler.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/rmi/transport/DGCAckHandler.java Fri Mar 07 13:00:25 2014 -0800
@@ -27,6 +27,7 @@
import java.rmi.server.UID;
import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -36,7 +37,6 @@
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import sun.rmi.runtime.RuntimeUtil;
-import sun.security.action.GetLongAction;
/**
* Holds strong references to a set of remote objects, or live remote
@@ -65,8 +65,8 @@
/** timeout for holding references without receiving an acknowledgment */
private static final long dgcAckTimeout = // default 5 minutes
- AccessController.doPrivileged(
- new GetLongAction("sun.rmi.dgc.ackTimeout", 300000));
+ AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+ Long.getLong("sun.rmi.dgc.ackTimeout", 300000));
/** thread pool for scheduling delayed tasks */
private static final ScheduledExecutorService scheduler =
--- a/jdk/src/share/classes/sun/rmi/transport/DGCClient.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/rmi/transport/DGCClient.java Fri Mar 07 13:00:25 2014 -0800
@@ -44,7 +44,6 @@
import sun.rmi.runtime.NewThreadAction;
import sun.rmi.server.UnicastRef;
import sun.rmi.server.Util;
-import sun.security.action.GetLongAction;
/**
* DGCClient implements the client-side of the RMI distributed garbage
@@ -85,21 +84,18 @@
/** lease duration to request (usually ignored by server) */
private static final long leaseValue = // default 10 minutes
- AccessController.doPrivileged(
- new GetLongAction("java.rmi.dgc.leaseValue",
- 600000)).longValue();
+ AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+ Long.getLong("java.rmi.dgc.leaseValue", 600000));
/** maximum interval between retries of failed clean calls */
private static final long cleanInterval = // default 3 minutes
- AccessController.doPrivileged(
- new GetLongAction("sun.rmi.dgc.cleanInterval",
- 180000)).longValue();
+ AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+ Long.getLong("sun.rmi.dgc.cleanInterval", 180000));
/** maximum interval between complete garbage collections of local heap */
private static final long gcInterval = // default 1 hour
- AccessController.doPrivileged(
- new GetLongAction("sun.rmi.dgc.client.gcInterval",
- 3600000)).longValue();
+ AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+ Long.getLong("sun.rmi.dgc.client.gcInterval", 3600000));
/** minimum retry count for dirty calls that fail */
private static final int dirtyFailureRetries = 5;
--- a/jdk/src/share/classes/sun/rmi/transport/DGCImpl.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/rmi/transport/DGCImpl.java Fri Mar 07 13:00:25 2014 -0800
@@ -50,8 +50,6 @@
import sun.rmi.server.UnicastRef;
import sun.rmi.server.UnicastServerRef;
import sun.rmi.server.Util;
-import sun.security.action.GetLongAction;
-import sun.security.action.GetPropertyAction;
/**
* This class implements the guts of the server-side distributed GC
@@ -65,17 +63,17 @@
/* dgc system log */
static final Log dgcLog = Log.getLog("sun.rmi.dgc", "dgc",
LogStream.parseLevel(AccessController.doPrivileged(
- new GetPropertyAction("sun.rmi.dgc.logLevel"))));
+ (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.dgc.logLevel"))));
/** lease duration to grant to clients */
private static final long leaseValue = // default 10 minutes
AccessController.doPrivileged(
- new GetLongAction("java.rmi.dgc.leaseValue", 600000));
+ (PrivilegedAction<Long>) () -> Long.getLong("java.rmi.dgc.leaseValue", 600000));
/** lease check interval; default is half of lease grant duration */
private static final long leaseCheckInterval =
AccessController.doPrivileged(
- new GetLongAction("sun.rmi.dgc.checkInterval", leaseValue / 2));
+ (PrivilegedAction<Long>) () -> Long.getLong("sun.rmi.dgc.checkInterval", leaseValue / 2));
/** thread pool for scheduling delayed tasks */
private static final ScheduledExecutorService scheduler =
--- a/jdk/src/share/classes/sun/rmi/transport/ObjectTable.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/rmi/transport/ObjectTable.java Fri Mar 07 13:00:25 2014 -0800
@@ -37,7 +37,6 @@
import sun.misc.GC;
import sun.rmi.runtime.Log;
import sun.rmi.runtime.NewThreadAction;
-import sun.security.action.GetLongAction;
/**
* Object table shared by all implementors of the Transport interface.
@@ -51,8 +50,8 @@
/** maximum interval between complete garbage collections of local heap */
private final static long gcInterval = // default 1 hour
- AccessController.doPrivileged(
- new GetLongAction("sun.rmi.dgc.server.gcInterval", 3600000));
+ AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+ Long.getLong("sun.rmi.dgc.server.gcInterval", 3600000));
/**
* lock guarding objTable and implTable.
--- a/jdk/src/share/classes/sun/rmi/transport/Transport.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/rmi/transport/Transport.java Fri Mar 07 13:00:25 2014 -0800
@@ -37,6 +37,7 @@
import java.rmi.server.RemoteServer;
import java.rmi.server.ServerNotActiveException;
import java.security.AccessControlContext;
+import java.security.PrivilegedAction;
import sun.rmi.runtime.Log;
import sun.rmi.server.Dispatcher;
import sun.rmi.server.UnicastServerRef;
@@ -55,7 +56,7 @@
private static String getLogLevel() {
return java.security.AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction("sun.rmi.transport.logLevel"));
+ (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.transport.logLevel"));
}
/* transport package log */
--- a/jdk/src/share/classes/sun/rmi/transport/proxy/HttpSendSocket.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/rmi/transport/proxy/HttpSendSocket.java Fri Mar 07 13:00:25 2014 -0800
@@ -26,6 +26,7 @@
import java.io.*;
import java.net.*;
+import java.security.PrivilegedAction;
import sun.rmi.runtime.Log;
@@ -79,7 +80,7 @@
*/
private String lineSeparator =
java.security.AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction("line.separator"));
+ (PrivilegedAction<String>) () -> System.getProperty("line.separator"));
/**
* Create a stream socket and connect it to the specified port on
--- a/jdk/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java Fri Mar 07 13:00:25 2014 -0800
@@ -32,9 +32,6 @@
import java.rmi.server.RMISocketFactory;
import sun.rmi.runtime.Log;
import sun.rmi.runtime.NewThreadAction;
-import sun.security.action.GetBooleanAction;
-import sun.security.action.GetLongAction;
-import sun.security.action.GetPropertyAction;
/**
* RMIMasterSocketFactory attempts to create a socket connection to the
@@ -53,7 +50,7 @@
private static String getLogLevel() {
return java.security.AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction("sun.rmi.transport.proxy.logLevel"));
+ (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.transport.proxy.logLevel"));
}
/* proxy package log */
@@ -65,15 +62,14 @@
private static long connectTimeout = getConnectTimeout();
private static long getConnectTimeout() {
- return java.security.AccessController.doPrivileged(
- new GetLongAction("sun.rmi.transport.proxy.connectTimeout",
- 15000)).longValue(); // default: 15 seconds
+ return java.security.AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+ Long.getLong("sun.rmi.transport.proxy.connectTimeout", 15000)); // default: 15 seconds
}
/** whether to fallback to HTTP on general connect failures */
private static final boolean eagerHttpFallback =
- java.security.AccessController.doPrivileged(new GetBooleanAction(
- "sun.rmi.transport.proxy.eagerHttpFallback")).booleanValue();
+ java.security.AccessController.doPrivileged((PrivilegedAction<Boolean>) () ->
+ Boolean.getBoolean("sun.rmi.transport.proxy.eagerHttpFallback"));
/** table of hosts successfully connected to and the factory used */
private Hashtable<String, RMISocketFactory> successTable =
@@ -104,14 +100,14 @@
try {
String proxyHost;
proxyHost = java.security.AccessController.doPrivileged(
- new GetPropertyAction("http.proxyHost"));
+ (PrivilegedAction<String>) () -> System.getProperty("http.proxyHost"));
if (proxyHost == null)
proxyHost = java.security.AccessController.doPrivileged(
- new GetPropertyAction("proxyHost"));
+ (PrivilegedAction<String>) () -> System.getProperty("proxyHost"));
boolean disable = java.security.AccessController.doPrivileged(
- new GetPropertyAction("java.rmi.server.disableHttp", "true"))
+ (PrivilegedAction<String>) () -> System.getProperty("java.rmi.server.disableHttp", "true"))
.equalsIgnoreCase("true");
if (!disable && proxyHost != null && proxyHost.length() > 0) {
--- a/jdk/src/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java Fri Mar 07 13:00:25 2014 -0800
@@ -27,6 +27,7 @@
import java.io.*;
import java.util.*;
import java.rmi.server.LogStream;
+import java.security.PrivilegedAction;
import sun.rmi.runtime.Log;
@@ -51,7 +52,7 @@
private static String getLogLevel() {
return java.security.AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction("sun.rmi.transport.tcp.multiplex.logLevel"));
+ (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.transport.tcp.multiplex.logLevel"));
}
/* multiplex system log */
--- a/jdk/src/share/classes/sun/rmi/transport/tcp/TCPChannel.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/rmi/transport/tcp/TCPChannel.java Fri Mar 07 13:00:25 2014 -0800
@@ -34,6 +34,7 @@
import java.rmi.RemoteException;
import java.security.AccessControlContext;
import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
@@ -48,8 +49,6 @@
import sun.rmi.transport.Connection;
import sun.rmi.transport.Endpoint;
import sun.rmi.transport.TransportConstants;
-import sun.security.action.GetIntegerAction;
-import sun.security.action.GetLongAction;
/**
* TCPChannel is the socket-based implementation of the RMI Channel
@@ -87,19 +86,18 @@
/** client-side connection idle usage timeout */
private static final long idleTimeout = // default 15 seconds
- AccessController.doPrivileged(
- new GetLongAction("sun.rmi.transport.connectionTimeout", 15000));
+ AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+ Long.getLong("sun.rmi.transport.connectionTimeout", 15000));
/** client-side connection handshake read timeout */
private static final int handshakeTimeout = // default 1 minute
- AccessController.doPrivileged(
- new GetIntegerAction("sun.rmi.transport.tcp.handshakeTimeout",
- 60000));
+ AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
+ Integer.getInteger("sun.rmi.transport.tcp.handshakeTimeout", 60000));
/** client-side connection response read timeout (after handshake) */
private static final int responseTimeout = // default infinity
- AccessController.doPrivileged(
- new GetIntegerAction("sun.rmi.transport.tcp.responseTimeout", 0));
+ AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
+ Integer.getInteger("sun.rmi.transport.tcp.responseTimeout", 0));
/** thread pool for scheduling delayed tasks */
private static final ScheduledExecutorService scheduler =
--- a/jdk/src/share/classes/sun/rmi/transport/tcp/TCPEndpoint.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/rmi/transport/tcp/TCPEndpoint.java Fri Mar 07 13:00:25 2014 -0800
@@ -38,6 +38,7 @@
import java.rmi.server.RMIServerSocketFactory;
import java.rmi.server.RMISocketFactory;
import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@@ -50,9 +51,6 @@
import sun.rmi.transport.Endpoint;
import sun.rmi.transport.Target;
import sun.rmi.transport.Transport;
-import sun.security.action.GetBooleanAction;
-import sun.security.action.GetIntegerAction;
-import sun.security.action.GetPropertyAction;
/**
* TCPEndpoint represents some communication endpoint for an address
@@ -82,12 +80,14 @@
// this should be a *private* method since it is privileged
private static int getInt(String name, int def) {
- return AccessController.doPrivileged(new GetIntegerAction(name, def));
+ return AccessController.doPrivileged(
+ (PrivilegedAction<Integer>) () -> Integer.getInteger(name, def));
}
// this should be a *private* method since it is privileged
private static boolean getBoolean(String name) {
- return AccessController.doPrivileged(new GetBooleanAction(name));
+ return AccessController.doPrivileged(
+ (PrivilegedAction<Boolean>) () -> Boolean.getBoolean(name));
}
/**
@@ -95,7 +95,7 @@
*/
private static String getHostnameProperty() {
return AccessController.doPrivileged(
- new GetPropertyAction("java.rmi.server.hostname"));
+ (PrivilegedAction<String>) () -> System.getProperty("java.rmi.server.hostname"));
}
/**
--- a/jdk/src/share/classes/sun/rmi/transport/tcp/TCPTransport.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/rmi/transport/tcp/TCPTransport.java Fri Mar 07 13:00:25 2014 -0800
@@ -49,6 +49,7 @@
import java.rmi.server.UID;
import java.security.AccessControlContext;
import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
@@ -73,9 +74,6 @@
import sun.rmi.transport.Transport;
import sun.rmi.transport.TransportConstants;
import sun.rmi.transport.proxy.HttpReceiveSocket;
-import sun.security.action.GetIntegerAction;
-import sun.security.action.GetLongAction;
-import sun.security.action.GetPropertyAction;
/**
* TCPTransport is the socket-based implementation of the RMI Transport
@@ -90,19 +88,18 @@
/* tcp package log */
static final Log tcpLog = Log.getLog("sun.rmi.transport.tcp", "tcp",
LogStream.parseLevel(AccessController.doPrivileged(
- new GetPropertyAction("sun.rmi.transport.tcp.logLevel"))));
+ (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.transport.tcp.logLevel"))));
/** maximum number of connection handler threads */
private static final int maxConnectionThreads = // default no limit
- AccessController.doPrivileged(
- new GetIntegerAction("sun.rmi.transport.tcp.maxConnectionThreads",
- Integer.MAX_VALUE));
+ AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
+ Integer.getInteger("sun.rmi.transport.tcp.maxConnectionThreads",
+ Integer.MAX_VALUE));
/** keep alive time for idle connection handler threads */
private static final long threadKeepAliveTime = // default 1 minute
- AccessController.doPrivileged(
- new GetLongAction("sun.rmi.transport.tcp.threadKeepAliveTime",
- 60000));
+ AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+ Long.getLong("sun.rmi.transport.tcp.threadKeepAliveTime", 60000));
/** thread pool for connection handlers */
private static final ExecutorService connectionThreadPool =
@@ -143,9 +140,8 @@
* and 20 hours.
*/
private static final int connectionReadTimeout = // default 2 hours
- AccessController.doPrivileged(
- new GetIntegerAction("sun.rmi.transport.tcp.readTimeout",
- 2 * 3600 * 1000));
+ AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
+ Integer.getInteger("sun.rmi.transport.tcp.readTimeout", 2 * 3600 * 1000));
/**
* Constructs a TCPTransport.
--- a/jdk/src/share/classes/sun/security/tools/policytool/PolicyTool.java Fri Mar 07 12:40:37 2014 -0800
+++ b/jdk/src/share/classes/sun/security/tools/policytool/PolicyTool.java Fri Mar 07 13:00:25 2014 -0800
@@ -1160,7 +1160,7 @@
if (policyFile == null) {
String userHome;
userHome = java.security.AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction("user.home"));
+ (PrivilegedAction<String>) () -> System.getProperty("user.home"));
policyFile = userHome + File.separatorChar + ".java.policy";
}