changeset 15672:df20e8be623d

8166359: java/net/URLPermission/nstest/lookup.sh fails if proxy is set since fix for JDK-8161016 Reviewed-by: chegar Contributed-by: Felix Yang <felix.yang@oracle.com>
author xiaofeya
date Wed, 21 Sep 2016 02:19:59 -0700
parents 7f6aa74d680f
children 33f2f7c81459 2acdea04aa37
files test/java/net/URLPermission/nstest/LookupTest.java test/java/net/URLPermission/nstest/LookupTestHosts test/java/net/URLPermission/nstest/lookup.sh
diffstat 3 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/net/URLPermission/nstest/LookupTest.java	Wed Sep 21 08:55:47 2016 +0800
+++ b/test/java/net/URLPermission/nstest/LookupTest.java	Wed Sep 21 02:19:59 2016 -0700
@@ -37,6 +37,7 @@
         String url, boolean throwsSecException, boolean throwsIOException)
     {
         try {
+            ProxySelector.setDefault(null);
             URL u = new URL(url);
             System.err.println ("Connecting to " + u);
             URLConnection urlc = u.openConnection();
@@ -71,7 +72,7 @@
             System.out.print(port);
         } else if (cmd.equals("-runtest")) {
             port = Integer.parseInt(args[1]);
-            String hostsFileName = System.getProperty("test.src", ".") + "/LookupTestHosts";
+            String hostsFileName = System.getProperty("user.dir", ".") + "/LookupTestHosts";
             System.setProperty("jdk.net.hosts.file", hostsFileName);
             addMappingToHostsFile("allowedAndFound.com", "127.0.0.1", hostsFileName, false);
             addMappingToHostsFile("notAllowedButFound.com", "99.99.99.99", hostsFileName, true);
--- a/test/java/net/URLPermission/nstest/LookupTestHosts	Wed Sep 21 08:55:47 2016 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-127.0.0.1 allowedAndFound.com
-99.99.99.99 notAllowedButFound.com
--- a/test/java/net/URLPermission/nstest/lookup.sh	Wed Sep 21 08:55:47 2016 +0800
+++ b/test/java/net/URLPermission/nstest/lookup.sh	Wed Sep 21 02:19:59 2016 -0700
@@ -48,6 +48,7 @@
 grant {
     permission java.net.URLPermission "http://allowedAndFound.com:${port}/-", "*:*";
     permission java.net.URLPermission "http://allowedButNotfound.com:${port}/-", "*:*";
+    permission java.net.NetPermission "setProxySelector";
     permission java.io.FilePermission "<<ALL FILES>>", "read,write,delete";
     permission java.util.PropertyPermission "java.io.tmpdir", "read";