--- a/jdk/test/java/net/URLPermission/URLPermissionTest.java Wed Jun 22 16:12:39 2016 +0900
+++ b/jdk/test/java/net/URLPermission/URLPermissionTest.java Wed Jun 22 09:01:34 2016 +0100
@@ -26,7 +26,7 @@
/**
* @test
- * @bug 8010464 8027570 8027687 8029354 8114860
+ * @bug 8010464 8027570 8027687 8029354 8114860 8071660
*/
public class URLPermissionTest {
@@ -110,6 +110,8 @@
static class ActionImpliesTest extends Test {
String arg1, arg2;
+ String url1 = "http://www.foo.com/-";
+ String url2 = "http://www.foo.com/a/b";
ActionImpliesTest(String arg1, String arg2, boolean expected) {
this.arg1 = arg1;
@@ -117,10 +119,17 @@
this.expected = expected;
}
+ ActionImpliesTest(String ur11, String url2, String arg1, String arg2,
+ boolean expected) {
+ this.url1 = ur11;
+ this.url2 = url2;
+ this.arg1 = arg1;
+ this.arg2 = arg2;
+ this.expected = expected;
+ }
+
@Override
boolean execute() {
- String url1 = "http://www.foo.com/-";
- String url2 = "http://www.foo.com/a/b";
URLPermission p1 = new URLPermission(url1, arg1);
URLPermission p2 = new URLPermission(url2, arg2);
boolean result = p1.implies(p2);
@@ -155,6 +164,11 @@
return new ActionImpliesTest(arg1, arg2, expected);
}
+ static ActionImpliesTest actest(String url1, String url2, String arg1,
+ String arg2, boolean expected) {
+ return new ActionImpliesTest(url1, url2, arg1, arg2, expected);
+ }
+
static class HashCodeTest extends Test {
String arg1, arg2;
int hash;
@@ -314,6 +328,9 @@
imtest("https:*", "http:*", false)
};
+ static final String FOO_URL = "http://www.foo.com/";
+ static final String BAR_URL = "http://www.bar.com/";
+
static Test[] actionImplies = {
actest("GET", "GET", true),
actest("GET", "POST", false),
@@ -327,7 +344,14 @@
actest("GET:X-Foo,X-Bar", "GET:x-bar,x-foo", true),
actest("GET:X-Bar,X-Foo,X-Bar,Y-Foo", "GET:x-bar,x-foo", true),
actest("GET:*", "GET:x-bar,x-foo", true),
- actest("*:*", "GET:x-bar,x-foo", true)
+ actest("*:*", "GET:x-bar,x-foo", true),
+ actest("", "GET:x-bar,x-foo", false),
+ actest("GET:x-bar,x-foo", "", true),
+ actest("", "", true),
+ actest("GET,DELETE", "GET,DELETE:x-foo", false),
+ actest(FOO_URL, BAR_URL, "", "GET:x-bar,x-foo", false),
+ actest(FOO_URL, BAR_URL, "GET:x-bar,x-foo", "", false),
+ actest(FOO_URL, BAR_URL, "", "", false)
};
static Test[] actionsStringTest = {