8161291: Serialization Tests for URLPermission is failing
authorvtewari
Tue, 26 Jul 2016 13:26:12 +0530
changeset 39775 37b3d7bf72ee
parent 39774 25d5618feb3c
child 39776 34d5b0a2af92
8161291: Serialization Tests for URLPermission is failing Reviewed-by: dfuchs, chegar
jdk/src/java.base/share/classes/java/net/URLPermission.java
jdk/test/java/net/URLPermission/URLPermissionTest.java
--- a/jdk/src/java.base/share/classes/java/net/URLPermission.java	Tue Jul 26 09:53:35 2016 +0800
+++ b/jdk/src/java.base/share/classes/java/net/URLPermission.java	Tue Jul 26 13:26:12 2016 +0530
@@ -461,11 +461,10 @@
     }
 
     private String actions() {
-        String b = String.join(",", methods);
-        if (!requestHeaders.isEmpty()) {
-            b += ":" + String.join(",", requestHeaders);
-        }
-        return b;
+        // The colon separator is optional when the request headers list is
+        // empty.This implementation chooses to include it even when the request
+        // headers list is empty.
+        return String.join(",", methods) + ":" + String.join(",", requestHeaders);
     }
 
     /**
--- a/jdk/test/java/net/URLPermission/URLPermissionTest.java	Tue Jul 26 09:53:35 2016 +0800
+++ b/jdk/test/java/net/URLPermission/URLPermissionTest.java	Tue Jul 26 13:26:12 2016 +0530
@@ -26,7 +26,7 @@
 
 /**
  * @test
- * @bug 8010464 8027570 8027687 8029354 8114860 8071660
+ * @bug 8010464 8027570 8027687 8029354 8114860 8071660 8161291
  */
 
 public class URLPermissionTest {
@@ -355,15 +355,16 @@
     };
 
     static Test[] actionsStringTest = {
-        actionstest("", ""),
+        actionstest("", ":"),
+        actionstest(":", ":"),
         actionstest(":X-Bar", ":X-Bar"),
-        actionstest("GET", "GET"),
-        actionstest("get", "GET"),
-        actionstest("GET,POST", "GET,POST"),
-        actionstest("GET,post", "GET,POST"),
-        actionstest("get,post", "GET,POST"),
-        actionstest("get,post,DELETE", "DELETE,GET,POST"),
-        actionstest("GET,POST:", "GET,POST"),
+        actionstest("GET", "GET:"),
+        actionstest("get", "GET:"),
+        actionstest("GET,POST", "GET,POST:"),
+        actionstest("GET,post", "GET,POST:"),
+        actionstest("get,post", "GET,POST:"),
+        actionstest("get,post,DELETE", "DELETE,GET,POST:"),
+        actionstest("GET,POST:", "GET,POST:"),
         actionstest("GET:X-Foo,X-bar", "GET:X-Bar,X-Foo"),
         actionstest("GET,POST,DELETE:X-Bar,X-Foo,X-Bar,Y-Foo", "DELETE,GET,POST:X-Bar,X-Bar,X-Foo,Y-Foo")
     };