http-client-branch: review comments remove superflous ssl permission check http-client-branch
authorchegar
Wed, 22 Nov 2017 15:29:29 +0000
branchhttp-client-branch
changeset 55856 038e64c3d92a
parent 55855 5cb7c3fbddcd
child 55857 89c904d57ebe
http-client-branch: review comments remove superflous ssl permission check
src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpClient.java
src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpClientBuilderImpl.java
src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpClientImpl.java
test/jdk/java/net/httpclient/security/0.policy
test/jdk/java/net/httpclient/security/1.policy
test/jdk/java/net/httpclient/security/10.policy
test/jdk/java/net/httpclient/security/11.policy
test/jdk/java/net/httpclient/security/12.policy
test/jdk/java/net/httpclient/security/14.policy
test/jdk/java/net/httpclient/security/15.policy
test/jdk/java/net/httpclient/security/2.policy
test/jdk/java/net/httpclient/security/3.policy
test/jdk/java/net/httpclient/security/4.policy
test/jdk/java/net/httpclient/security/5.policy
test/jdk/java/net/httpclient/security/6.policy
test/jdk/java/net/httpclient/security/7.policy
test/jdk/java/net/httpclient/security/8.policy
test/jdk/java/net/httpclient/security/9.policy
test/jdk/java/net/httpclient/security/filePerms/httpclient.policy
test/jdk/java/net/httpclient/websocket/security/httpclient.policy
--- a/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpClient.java	Wed Nov 22 15:26:44 2017 +0000
+++ b/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpClient.java	Wed Nov 22 15:29:29 2017 +0000
@@ -139,9 +139,6 @@
          *
          * @param sslContext the SSLContext
          * @return this builder
-         * @throws SecurityException if a security manager has been installed
-         *          and it denies {@linkplain java.net.NetPermission}
-         *          ({@code "setSSLContext"})
          */
         public abstract Builder sslContext(SSLContext sslContext);
 
@@ -305,9 +302,6 @@
      * {@linkplain SSLContext#getDefault() default context} is returned.
      *
      * @return this client's SSLContext
-     * @throws SecurityException if a security manager has been installed
-     *          and it denies {@linkplain java.net.NetPermission}
-     *          ({@code "getSSLContext"})
      */
     public abstract SSLContext sslContext();
 
--- a/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpClientBuilderImpl.java	Wed Nov 22 15:26:44 2017 +0000
+++ b/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpClientBuilderImpl.java	Wed Nov 22 15:29:29 2017 +0000
@@ -27,7 +27,6 @@
 
 import java.net.Authenticator;
 import java.net.CookieHandler;
-import java.net.NetPermission;
 import java.net.ProxySelector;
 import java.util.concurrent.Executor;
 import javax.net.ssl.SSLContext;
@@ -59,11 +58,6 @@
     @Override
     public HttpClientBuilderImpl sslContext(SSLContext sslContext) {
         requireNonNull(sslContext);
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null) {
-            NetPermission np = new NetPermission("setSSLContext");
-            sm.checkPermission(np);
-        }
         this.sslContext = sslContext;
         return this;
     }
--- a/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpClientImpl.java	Wed Nov 22 15:26:44 2017 +0000
+++ b/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpClientImpl.java	Wed Nov 22 15:29:29 2017 +0000
@@ -32,7 +32,6 @@
 import java.lang.ref.WeakReference;
 import java.net.Authenticator;
 import java.net.CookieHandler;
-import java.net.NetPermission;
 import java.net.ProxySelector;
 import java.nio.channels.CancelledKeyException;
 import java.nio.channels.ClosedChannelException;
@@ -871,11 +870,6 @@
 
     @Override
     public SSLContext sslContext() {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null) {
-            NetPermission np = new NetPermission("getSSLContext");
-            sm.checkPermission(np);
-        }
         return sslContext;
     }
 
--- a/test/jdk/java/net/httpclient/security/0.policy	Wed Nov 22 15:26:44 2017 +0000
+++ b/test/jdk/java/net/httpclient/security/0.policy	Wed Nov 22 15:29:29 2017 +0000
@@ -4,7 +4,6 @@
     // permissions common to all tests
     permission java.util.PropertyPermission "*", "read";
     permission java.io.FilePermission "${test.classes}${/}-", "read,write,delete";
-    permission java.net.NetPermission "getDefaultHttpClient";
     permission java.lang.RuntimePermission "modifyThread";
     permission java.util.logging.LoggingPermission "control", "";
     permission java.net.SocketPermission "localhost:1024-", "accept,listen";
@@ -40,9 +39,6 @@
 
     permission java.util.PropertyPermission "jdk.httpclient.*","read";
 
-    // ## these permissions do not appear in the NetPermission spec!!! JDK bug?
-    permission java.net.NetPermission "getSSLContext";
-    permission java.net.NetPermission "setSSLContext";
     permission java.net.NetPermission "getProxySelector";
 };
 
--- a/test/jdk/java/net/httpclient/security/1.policy	Wed Nov 22 15:26:44 2017 +0000
+++ b/test/jdk/java/net/httpclient/security/1.policy	Wed Nov 22 15:29:29 2017 +0000
@@ -3,7 +3,6 @@
     // permissions common to all tests
     permission java.util.PropertyPermission "*", "read";
     permission java.io.FilePermission "${test.classes}${/}-", "read,write,delete";
-    permission java.net.NetPermission "getDefaultHttpClient";
     permission java.lang.RuntimePermission "modifyThread";
     permission java.util.logging.LoggingPermission "control", "";
     permission java.net.SocketPermission "localhost:1024-", "accept,listen";
@@ -40,9 +39,6 @@
 
     permission java.util.PropertyPermission "jdk.httpclient.*","read";
 
-    // ## these permissions do not appear in the NetPermission spec!!! JDK bug?
-    permission java.net.NetPermission "getSSLContext";
-    permission java.net.NetPermission "setSSLContext";
     permission java.net.NetPermission "getProxySelector";
 };
 
--- a/test/jdk/java/net/httpclient/security/10.policy	Wed Nov 22 15:26:44 2017 +0000
+++ b/test/jdk/java/net/httpclient/security/10.policy	Wed Nov 22 15:29:29 2017 +0000
@@ -3,7 +3,6 @@
     // permissions common to all tests
     permission java.util.PropertyPermission "*", "read";
     permission java.io.FilePermission "${test.classes}${/}-", "read,write,delete";
-    permission java.net.NetPermission "getDefaultHttpClient";
     permission java.lang.RuntimePermission "modifyThread";
     permission java.util.logging.LoggingPermission "control", "";
     permission java.net.SocketPermission "localhost:1024-", "accept,listen";
@@ -39,9 +38,6 @@
 
     permission java.util.PropertyPermission "jdk.httpclient.*","read";
 
-    // ## these permissions do not appear in the NetPermission spec!!! JDK bug?
-    permission java.net.NetPermission "getSSLContext";
-    permission java.net.NetPermission "setSSLContext";
     permission java.net.NetPermission "getProxySelector";
 };
 
--- a/test/jdk/java/net/httpclient/security/11.policy	Wed Nov 22 15:26:44 2017 +0000
+++ b/test/jdk/java/net/httpclient/security/11.policy	Wed Nov 22 15:29:29 2017 +0000
@@ -3,7 +3,6 @@
     // permissions common to all tests
     permission java.util.PropertyPermission "*", "read";
     permission java.io.FilePermission "${test.classes}${/}-", "read,write,delete";
-    permission java.net.NetPermission "getDefaultHttpClient";
     permission java.lang.RuntimePermission "modifyThread";
     permission java.util.logging.LoggingPermission "control", "";
     permission java.net.SocketPermission "localhost:1024-", "accept,listen";
@@ -41,9 +40,6 @@
 
     permission java.util.PropertyPermission "jdk.httpclient.*","read";
 
-    // ## these permissions do not appear in the NetPermission spec!!! JDK bug?
-    permission java.net.NetPermission "getSSLContext";
-    permission java.net.NetPermission "setSSLContext";
     permission java.net.NetPermission "getProxySelector";
 };
 
--- a/test/jdk/java/net/httpclient/security/12.policy	Wed Nov 22 15:26:44 2017 +0000
+++ b/test/jdk/java/net/httpclient/security/12.policy	Wed Nov 22 15:29:29 2017 +0000
@@ -3,7 +3,6 @@
     // permissions common to all tests
     permission java.util.PropertyPermission "*", "read";
     permission java.io.FilePermission "${test.classes}${/}-", "read,write,delete";
-    permission java.net.NetPermission "getDefaultHttpClient";
     permission java.lang.RuntimePermission "modifyThread";
     permission java.util.logging.LoggingPermission "control", "";
     permission java.net.SocketPermission "localhost:1024-", "accept,listen";
@@ -41,9 +40,6 @@
 
     permission java.util.PropertyPermission "jdk.httpclient.*","read";
 
-    // ## these permissions do not appear in the NetPermission spec!!! JDK bug?
-    permission java.net.NetPermission "getSSLContext";
-    permission java.net.NetPermission "setSSLContext";
     permission java.net.NetPermission "getProxySelector";
 };
 
--- a/test/jdk/java/net/httpclient/security/14.policy	Wed Nov 22 15:26:44 2017 +0000
+++ b/test/jdk/java/net/httpclient/security/14.policy	Wed Nov 22 15:29:29 2017 +0000
@@ -3,7 +3,6 @@
     // permissions common to all tests
     permission java.util.PropertyPermission "*", "read";
     permission java.io.FilePermission "${test.classes}${/}-", "read,write,delete";
-    permission java.net.NetPermission "getDefaultHttpClient";
     permission java.lang.RuntimePermission "modifyThread";
     permission java.util.logging.LoggingPermission "control", "";
     permission java.net.SocketPermission "localhost:1024-", "accept,listen";
@@ -40,9 +39,6 @@
 
     permission java.util.PropertyPermission "jdk.httpclient.*","read";
 
-    // ## these permissions do not appear in the NetPermission spec!!! JDK bug?
-    permission java.net.NetPermission "getSSLContext";
-    permission java.net.NetPermission "setSSLContext";
     permission java.net.NetPermission "getProxySelector";
 };
 
--- a/test/jdk/java/net/httpclient/security/15.policy	Wed Nov 22 15:26:44 2017 +0000
+++ b/test/jdk/java/net/httpclient/security/15.policy	Wed Nov 22 15:29:29 2017 +0000
@@ -3,7 +3,6 @@
     // permissions common to all tests
     permission java.util.PropertyPermission "*", "read";
     permission java.io.FilePermission "${test.classes}${/}-", "read,write,delete";
-    permission java.net.NetPermission "getDefaultHttpClient";
     permission java.lang.RuntimePermission "modifyThread";
     permission java.util.logging.LoggingPermission "control", "";
     permission java.net.SocketPermission "localhost:1024-", "accept,listen";
@@ -43,9 +42,6 @@
 
     permission java.util.PropertyPermission "jdk.httpclient.*","read";
 
-    // ## these permissions do not appear in the NetPermission spec!!! JDK bug?
-    permission java.net.NetPermission "getSSLContext";
-    permission java.net.NetPermission "setSSLContext";
     permission java.net.NetPermission "getProxySelector";
 };
 
--- a/test/jdk/java/net/httpclient/security/2.policy	Wed Nov 22 15:26:44 2017 +0000
+++ b/test/jdk/java/net/httpclient/security/2.policy	Wed Nov 22 15:29:29 2017 +0000
@@ -3,7 +3,6 @@
     // permissions common to all tests
     permission java.util.PropertyPermission "*", "read";
     permission java.io.FilePermission "${test.classes}${/}-", "read,write,delete";
-    permission java.net.NetPermission "getDefaultHttpClient";
     permission java.lang.RuntimePermission "modifyThread";
     permission java.util.logging.LoggingPermission "control", "";
     permission java.net.SocketPermission "localhost:1024-", "accept,listen";
@@ -40,9 +39,6 @@
 
     permission java.util.PropertyPermission "jdk.httpclient.*","read";
 
-    // ## these permissions do not appear in the NetPermission spec!!! JDK bug?
-    permission java.net.NetPermission "getSSLContext";
-    permission java.net.NetPermission "setSSLContext";
     permission java.net.NetPermission "getProxySelector";
 };
 
--- a/test/jdk/java/net/httpclient/security/3.policy	Wed Nov 22 15:26:44 2017 +0000
+++ b/test/jdk/java/net/httpclient/security/3.policy	Wed Nov 22 15:29:29 2017 +0000
@@ -3,7 +3,6 @@
     // permissions common to all tests
     permission java.util.PropertyPermission "*", "read";
     permission java.io.FilePermission "${test.classes}${/}-", "read,write,delete";
-    permission java.net.NetPermission "getDefaultHttpClient";
     permission java.lang.RuntimePermission "modifyThread";
     permission java.util.logging.LoggingPermission "control", "";
     permission java.net.SocketPermission "localhost:1024-", "accept,listen";
@@ -40,9 +39,6 @@
 
     permission java.util.PropertyPermission "jdk.httpclient.*","read";
 
-    // ## these permissions do not appear in the NetPermission spec!!! JDK bug?
-    permission java.net.NetPermission "getSSLContext";
-    permission java.net.NetPermission "setSSLContext";
     permission java.net.NetPermission "getProxySelector";
 };
 
--- a/test/jdk/java/net/httpclient/security/4.policy	Wed Nov 22 15:26:44 2017 +0000
+++ b/test/jdk/java/net/httpclient/security/4.policy	Wed Nov 22 15:29:29 2017 +0000
@@ -3,7 +3,6 @@
     // permissions common to all tests
     permission java.util.PropertyPermission "*", "read";
     permission java.io.FilePermission "${test.classes}${/}-", "read,write,delete";
-    permission java.net.NetPermission "getDefaultHttpClient";
     permission java.lang.RuntimePermission "modifyThread";
     permission java.util.logging.LoggingPermission "control", "";
     permission java.net.SocketPermission "localhost:1024-", "accept,listen";
@@ -41,9 +40,6 @@
 
     permission java.util.PropertyPermission "jdk.httpclient.*","read";
 
-    // ## these permissions do not appear in the NetPermission spec!!! JDK bug?
-    permission java.net.NetPermission "getSSLContext";
-    permission java.net.NetPermission "setSSLContext";
     permission java.net.NetPermission "getProxySelector";
 };
 
--- a/test/jdk/java/net/httpclient/security/5.policy	Wed Nov 22 15:26:44 2017 +0000
+++ b/test/jdk/java/net/httpclient/security/5.policy	Wed Nov 22 15:29:29 2017 +0000
@@ -3,7 +3,6 @@
     // permissions common to all tests
     permission java.util.PropertyPermission "*", "read";
     permission java.io.FilePermission "${test.classes}${/}-", "read,write,delete";
-    permission java.net.NetPermission "getDefaultHttpClient";
     permission java.lang.RuntimePermission "modifyThread";
     permission java.util.logging.LoggingPermission "control", "";
     permission java.net.SocketPermission "localhost:1024-", "accept,listen";
@@ -40,9 +39,6 @@
 
     permission java.util.PropertyPermission "jdk.httpclient.*","read";
 
-    // ## these permissions do not appear in the NetPermission spec!!! JDK bug?
-    permission java.net.NetPermission "getSSLContext";
-    permission java.net.NetPermission "setSSLContext";
     permission java.net.NetPermission "getProxySelector";
 };
 
--- a/test/jdk/java/net/httpclient/security/6.policy	Wed Nov 22 15:26:44 2017 +0000
+++ b/test/jdk/java/net/httpclient/security/6.policy	Wed Nov 22 15:29:29 2017 +0000
@@ -3,7 +3,6 @@
     // permissions common to all tests
     permission java.util.PropertyPermission "*", "read";
     permission java.io.FilePermission "${test.classes}${/}-", "read,write,delete";
-    permission java.net.NetPermission "getDefaultHttpClient";
     permission java.lang.RuntimePermission "modifyThread";
     permission java.util.logging.LoggingPermission "control", "";
     permission java.net.SocketPermission "localhost:1024-", "accept,listen";
@@ -40,9 +39,6 @@
 
     permission java.util.PropertyPermission "jdk.httpclient.*","read";
 
-    // ## these permissions do not appear in the NetPermission spec!!! JDK bug?
-    permission java.net.NetPermission "getSSLContext";
-    permission java.net.NetPermission "setSSLContext";
     permission java.net.NetPermission "getProxySelector";
 };
 
--- a/test/jdk/java/net/httpclient/security/7.policy	Wed Nov 22 15:26:44 2017 +0000
+++ b/test/jdk/java/net/httpclient/security/7.policy	Wed Nov 22 15:29:29 2017 +0000
@@ -3,7 +3,6 @@
     // permissions common to all tests
     permission java.util.PropertyPermission "*", "read";
     permission java.io.FilePermission "${test.classes}${/}-", "read,write,delete";
-    permission java.net.NetPermission "getDefaultHttpClient";
     permission java.lang.RuntimePermission "modifyThread";
     permission java.util.logging.LoggingPermission "control", "";
     permission java.net.SocketPermission "localhost:1024-", "accept,listen";
@@ -40,9 +39,6 @@
 
     permission java.util.PropertyPermission "jdk.httpclient.*","read";
 
-    // ## these permissions do not appear in the NetPermission spec!!! JDK bug?
-    permission java.net.NetPermission "getSSLContext";
-    permission java.net.NetPermission "setSSLContext";
     permission java.net.NetPermission "getProxySelector";
 };
 
--- a/test/jdk/java/net/httpclient/security/8.policy	Wed Nov 22 15:26:44 2017 +0000
+++ b/test/jdk/java/net/httpclient/security/8.policy	Wed Nov 22 15:29:29 2017 +0000
@@ -3,7 +3,6 @@
     // permissions common to all tests
     permission java.util.PropertyPermission "*", "read";
     permission java.io.FilePermission "${test.classes}${/}-", "read,write,delete";
-    permission java.net.NetPermission "getDefaultHttpClient";
     permission java.lang.RuntimePermission "modifyThread";
     permission java.util.logging.LoggingPermission "control", "";
     permission java.net.SocketPermission "localhost:1024-", "accept,listen";
@@ -40,9 +39,6 @@
 
     permission java.util.PropertyPermission "jdk.httpclient.*","read";
 
-    // ## these permissions do not appear in the NetPermission spec!!! JDK bug?
-    permission java.net.NetPermission "getSSLContext";
-    permission java.net.NetPermission "setSSLContext";
     permission java.net.NetPermission "getProxySelector";
 };
 
--- a/test/jdk/java/net/httpclient/security/9.policy	Wed Nov 22 15:26:44 2017 +0000
+++ b/test/jdk/java/net/httpclient/security/9.policy	Wed Nov 22 15:29:29 2017 +0000
@@ -3,7 +3,6 @@
     // permissions common to all tests
     permission java.util.PropertyPermission "*", "read";
     permission java.io.FilePermission "${test.classes}${/}-", "read,write,delete";
-    permission java.net.NetPermission "getDefaultHttpClient";
     permission java.lang.RuntimePermission "modifyThread";
     permission java.util.logging.LoggingPermission "control", "";
     permission java.net.SocketPermission "localhost:1024-", "accept,listen";
@@ -40,9 +39,6 @@
 
     permission java.util.PropertyPermission "jdk.httpclient.*","read";
 
-    // ## these permissions do not appear in the NetPermission spec!!! JDK bug?
-    permission java.net.NetPermission "getSSLContext";
-    permission java.net.NetPermission "setSSLContext";
     permission java.net.NetPermission "getProxySelector";
 };
 
--- a/test/jdk/java/net/httpclient/security/filePerms/httpclient.policy	Wed Nov 22 15:26:44 2017 +0000
+++ b/test/jdk/java/net/httpclient/security/filePerms/httpclient.policy	Wed Nov 22 15:29:29 2017 +0000
@@ -33,9 +33,6 @@
     permission java.util.PropertyPermission "jdk.internal.httpclient.hpack.log.level","read";
     permission java.util.PropertyPermission "test.src","read";
 
-    // ## these permissions do not appear in the NetPermission spec!!! JDK bug?
-    permission java.net.NetPermission "getSSLContext";
-    permission java.net.NetPermission "setSSLContext";
     permission java.net.NetPermission "getProxySelector";
 
     permission java.security.SecurityPermission "createAccessControlContext";
--- a/test/jdk/java/net/httpclient/websocket/security/httpclient.policy	Wed Nov 22 15:26:44 2017 +0000
+++ b/test/jdk/java/net/httpclient/websocket/security/httpclient.policy	Wed Nov 22 15:29:29 2017 +0000
@@ -33,9 +33,6 @@
     permission java.util.PropertyPermission "jdk.internal.httpclient.hpack.log.level","read";
     permission java.util.PropertyPermission "test.src","read";
 
-    // ## these permissions do not appear in the NetPermission spec!!! JDK bug?
-    permission java.net.NetPermission "getSSLContext";
-    permission java.net.NetPermission "setSSLContext";
     permission java.net.NetPermission "getProxySelector";
 
     permission java.security.SecurityPermission "createAccessControlContext";