< prev index next >

src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java

Print this page
rev 14210 : 8154231: Simplify access to System properties from JDK code
Reviewed-by: rriggs

@@ -29,10 +29,11 @@
 import java.security.AccessController;
 import sun.net.ResourceManager;
 import java.util.Set;
 import java.util.HashSet;
 import java.util.Collections;
+import sun.security.action.GetPropertyAction;
 
 /**
  * Abstract datagram and multicast socket implementation base class.
  * Note: This is not a public class, so that applets cannot call
  * into the implementation directly and hence cannot bypass the

@@ -49,13 +50,11 @@
     boolean connected = false;
     private int trafficClass = 0;
     protected InetAddress connectedAddress = null;
     private int connectedPort = -1;
 
-    private static final String os = AccessController.doPrivileged(
-        new sun.security.action.GetPropertyAction("os.name")
-    );
+    private static final String os = GetPropertyAction.getProperty("os.name");
 
     /**
      * flag set if the native connect() call not to be used
      */
     private static final boolean connectDisabled = os.contains("OS X");
< prev index next >