8166359: java/net/URLPermission/nstest/lookup.sh fails if proxy is set since fix for JDK-8161016

Reviewed-by: chegar
This commit is contained in:
Felix Yang 2016-09-21 02:19:59 -07:00 committed by Felix Yang
parent 3e5ef4867f
commit 0d0e86808b
3 changed files with 3 additions and 3 deletions

View File

@ -37,6 +37,7 @@ public class LookupTest {
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 @@ public class LookupTest {
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);

View File

@ -1,2 +0,0 @@
127.0.0.1 allowedAndFound.com
99.99.99.99 notAllowedButFound.com

View File

@ -48,6 +48,7 @@ cat << POLICY > policy
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";