< prev index next >
src/java.base/unix/classes/java/lang/ProcessImpl.java
Print this page
rev 14210 : 8154231: Simplify access to System properties from JDK code
Reviewed-by: rriggs
*** 44,55 ****
--- 44,57 ----
import java.security.AccessController;
import static java.security.AccessController.doPrivileged;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
+ import java.util.Properties;
import jdk.internal.misc.JavaIOFileDescriptorAccess;
import jdk.internal.misc.SharedSecrets;
+ import sun.security.action.GetPropertyAction;
/**
* java.lang.Process subclass in the UNIX environment.
*
* @author Mario Wolczko and Ross Knippel.
*** 121,135 ****
throw new AssertionError("Unsupported platform: " + this);
}
}
String helperPath() {
! return AccessController.doPrivileged(
! (PrivilegedAction<String>) () ->
! helperPath(System.getProperty("java.home"),
! System.getProperty("os.arch"))
! );
}
LaunchMechanism launchMechanism() {
return AccessController.doPrivileged(
(PrivilegedAction<LaunchMechanism>) () -> {
--- 123,135 ----
throw new AssertionError("Unsupported platform: " + this);
}
}
String helperPath() {
! Properties props = GetPropertyAction.getProperties();
! return helperPath(props.getProperty("java.home"),
! props.getProperty("os.arch"));
}
LaunchMechanism launchMechanism() {
return AccessController.doPrivileged(
(PrivilegedAction<LaunchMechanism>) () -> {
*** 157,169 ****
}
);
}
static Platform get() {
! String osName = AccessController.doPrivileged(
! (PrivilegedAction<String>) () -> System.getProperty("os.name")
! );
if (osName.equals("Linux")) { return LINUX; }
if (osName.contains("OS X")) { return BSD; }
if (osName.equals("SunOS")) { return SOLARIS; }
if (osName.equals("AIX")) { return AIX; }
--- 157,167 ----
}
);
}
static Platform get() {
! String osName = GetPropertyAction.getProperty("os.name");
if (osName.equals("Linux")) { return LINUX; }
if (osName.contains("OS X")) { return BSD; }
if (osName.equals("SunOS")) { return SOLARIS; }
if (osName.equals("AIX")) { return AIX; }
< prev index next >