< prev index next >

src/java.base/windows/classes/java/net/DefaultDatagramSocketImplFactory.java

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

*** 22,33 **** * or visit www.oracle.com if you need additional information or have any * questions. */ package java.net; ! import java.security.AccessController; ! import java.security.PrivilegedAction; import sun.security.action.GetPropertyAction; /** * This class defines a factory for creating DatagramSocketImpls. It defaults * to creating plain DatagramSocketImpls, but may create other DatagramSocketImpls --- 22,32 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ package java.net; ! import java.util.Properties; import sun.security.action.GetPropertyAction; /** * This class defines a factory for creating DatagramSocketImpls. It defaults * to creating plain DatagramSocketImpls, but may create other DatagramSocketImpls
*** 55,79 **** private static final boolean exclusiveBind; static { Class<?> prefixImplClassLocal = null; preferIPv4Stack = Boolean.parseBoolean( ! AccessController.doPrivileged( ! new GetPropertyAction("java.net.preferIPv4Stack"))); ! String exclBindProp = AccessController.doPrivileged( ! new GetPropertyAction("sun.net.useExclusiveBind", "")); exclusiveBind = (exclBindProp.isEmpty()) ? true : Boolean.parseBoolean(exclBindProp); // impl.prefix String prefix = null; try { ! prefix = AccessController.doPrivileged( ! new GetPropertyAction("impl.prefix", null)); if (prefix != null) prefixImplClassLocal = Class.forName("java.net."+prefix+"DatagramSocketImpl"); } catch (Exception e) { System.err.println("Can't find class: java.net." + prefix + --- 54,76 ---- private static final boolean exclusiveBind; static { Class<?> prefixImplClassLocal = null; + Properties props = GetPropertyAction.getProperties(); preferIPv4Stack = Boolean.parseBoolean( ! props.getProperty("java.net.preferIPv4Stack")); ! String exclBindProp = props.getProperty("sun.net.useExclusiveBind", ""); exclusiveBind = (exclBindProp.isEmpty()) ? true : Boolean.parseBoolean(exclBindProp); // impl.prefix String prefix = null; try { ! prefix = props.getProperty("impl.prefix"); if (prefix != null) prefixImplClassLocal = Class.forName("java.net."+prefix+"DatagramSocketImpl"); } catch (Exception e) { System.err.println("Can't find class: java.net." + prefix +
< prev index next >