diff -r ff3bfe024b5f -r 09df5383d1df jdk/test/java/net/URLPermission/URLPermissionTest.java --- a/jdk/test/java/net/URLPermission/URLPermissionTest.java Sun Jan 05 21:02:57 2014 -0800 +++ b/jdk/test/java/net/URLPermission/URLPermissionTest.java Mon Jan 06 11:00:12 2014 +0000 @@ -26,7 +26,7 @@ /** * @test - * @bug 8010464 8027570 8027687 + * @bug 8010464 8027570 8027687 8029354 */ public class URLPermissionTest { @@ -37,7 +37,30 @@ abstract boolean execute(); }; + // Instantiation: should succeed + static class CreateTest extends Test { + String arg; + CreateTest(String arg) { + this.arg = arg; + } + + @Override + boolean execute() { + try { + URLPermission p = new URLPermission(arg); + return true; + } catch (Exception e) { + return false; + } + } + }; + + static CreateTest createtest(String arg) { + return new CreateTest(arg); + } + // Should throw an IAE on construction + static class ExTest extends Test { String arg; ExTest(String arg) { @@ -262,6 +285,7 @@ imtest("https://www.foo.com/a/b", "https://www.foo.com:443/a/b", true), imtest("https://www.foo.com:200-500/a/b", "https://www.foo.com/a/b", true), imtest("http://www.foo.com:*/a/b", "http://www.foo.com:1-12345/a/b", true), + imtest("http://host/a/b", "http://HOST/a/b", true), // misc imtest("https:*", "http://www.foo.com", false), @@ -297,6 +321,16 @@ eqtest("http://www.foo.com/a/b", "http://www.foo.com:82/a/b", false), eqtest("https://www.foo.com/a/b", "https://www.foo.com:443/a/b", true), eqtest("https://www.foo.com/a/b", "https://www.foo.com:444/a/b", false), + eqtest("http://michael@foo.com/bar","http://michael@foo.com/bar", true), + eqtest("http://Michael@foo.com/bar","http://michael@goo.com/bar",false), + eqtest("http://michael@foo.com/bar","http://george@foo.com/bar", true), + eqtest("http://@foo.com/bar","http://foo.com/bar", true) + }; + + static Test[] createTests = { + createtest("http://user@foo.com/a/b/c"), + createtest("http://user:pass@foo.com/a/b/c"), + createtest("http://user:@foo.com/a/b/c") }; static boolean failed = false; @@ -386,6 +420,17 @@ } } + for (int i=0; i