< prev index next >

test/lib/jdk/test/lib/Platform.java

Print this page
@  rev 55753 : 8228434: jdk/net/Sockets/Test.java fails after JDK-8227642
|  Reviewed-by: duke
~

@@ -31,16 +31,23 @@
 import java.security.PrivilegedAction;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 
 public class Platform {
+
+    public static class Docker {
     // Use this property to specify docker location on your system.
     // E.g.: "/usr/local/bin/docker". We define this constant here so
     // that it can be used in VMProps as well which checks docker support
     // via this command
-    public static final String DOCKER_COMMAND =
-        System.getProperty("jdk.test.docker.command", "docker");
+        public static final String DOCKER_COMMAND = privilegedGetProperty("jdk.test.docker.command", "docker");
+
+        private static String privilegedGetProperty(String key, String defaultValue) {
+            PrivilegedAction<String> pa = () -> System.getProperty(key, defaultValue);
+            return AccessController.doPrivileged(pa);
+        }
+    }
     public  static final String vmName      = privilegedGetProperty("java.vm.name");
     public  static final String vmInfo      = privilegedGetProperty("java.vm.info");
     private static final String osVersion   = privilegedGetProperty("os.version");
     private static       int osVersionMajor = -1;
     private static       int osVersionMinor = -1;
< prev index next >