--- a/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java Fri Mar 09 16:47:00 2018 +0000
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java Fri Mar 09 16:52:31 2018 +0000
@@ -90,7 +90,14 @@
public static final boolean TESTING = DEBUG;
public static final boolean isHostnameVerificationDisabled = // enabled by default
- getBooleanProperty("jdk.internal.http.disableHostnameVerification", false);
+ hostnameVerificationDisabledValue();
+
+ private static boolean hostnameVerificationDisabledValue() {
+ String prop = getProperty("jdk.internal.http.disableHostnameVerification");
+ if (prop == null)
+ return false;
+ return prop.isEmpty() ? true : Boolean.parseBoolean(prop);
+ }
/**
* Allocated buffer size. Must never be higher than 16K. But can be lower
@@ -383,6 +390,11 @@
Boolean.parseBoolean(System.getProperty(name, String.valueOf(def))));
}
+ public static String getProperty(String name) {
+ return AccessController.doPrivileged((PrivilegedAction<String>) () ->
+ System.getProperty(name));
+ }
+
public static SSLParameters copySSLParameters(SSLParameters p) {
SSLParameters p1 = new SSLParameters();
p1.setAlgorithmConstraints(p.getAlgorithmConstraints());