changeset 17681:98d584f5e429

Add-Exports/Add-Exports-Private value should use space as separator
author alanb
date Tue, 06 Sep 2016 11:25:29 +0100
parents 348721d21fa8
children ab7f12d892bf
files src/java.base/share/classes/sun/launcher/LauncherHelper.java test/tools/launcher/modules/addexports/manifest/AddExportsInManifest.java
diffstat 2 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/sun/launcher/LauncherHelper.java	Mon Sep 05 15:50:11 2016 +0100
+++ b/src/java.base/share/classes/sun/launcher/LauncherHelper.java	Tue Sep 06 11:25:29 2016 +0100
@@ -483,10 +483,10 @@
 
     /**
      * Process Add-Exports or Add-Exports-All value. The value is
-     * {@code <module>/<package>(,<module>/<package>)*}.
+     * {@code <module>/<package> ( <module>/<package>)*}.
      */
     static void addExports(String value, boolean nonPublic, Set<String> values) {
-        for (String moduleAndPackage : value.split(",")) {
+        for (String moduleAndPackage : value.split(" ")) {
             String[] s = moduleAndPackage.trim().split("/");
             if (s.length == 2) {
 
--- a/test/tools/launcher/modules/addexports/manifest/AddExportsInManifest.java	Mon Sep 05 15:50:11 2016 +0100
+++ b/test/tools/launcher/modules/addexports/manifest/AddExportsInManifest.java	Tue Sep 06 11:25:29 2016 +0100
@@ -114,7 +114,15 @@
         runExpectingFail("Main-Class=Test2,Add-Exports=java.base/jdk.internal.misc",
                          "InaccessibleObjectException");
 
+        // run with leading and trailing spaces
+        runExpectingPass("Main-Class=Test1,Add-Exports=  java.base/jdk.internal.misc");
+        runExpectingPass("Main-Class=Test1,Add-Exports=java.base/jdk.internal.misc  ");
 
+        // run with multiple values
+        runExpectingPass("Main-Class=Test1,Add-Exports=java.base/jdk.internal.misc"
+                + " java.base/jdk.internal.loader");
+        runExpectingPass("Main-Class=Test1,Add-Exports=java.base/jdk.internal.loader"
+                + " java.base/jdk.internal.misc");
     }
 
     /**
@@ -123,6 +131,16 @@
     public void testWithAddExportsPrivate() throws Exception {
         runExpectingPass("Main-Class=Test1,Add-Exports-Private=java.base/jdk.internal.misc");
         runExpectingPass("Main-Class=Test2,Add-Exports-Private=java.base/jdk.internal.misc");
+
+        // run with leading and trailing spaces
+        runExpectingPass("Main-Class=Test1,Add-Exports-Private=  java.base/jdk.internal.misc");
+        runExpectingPass("Main-Class=Test1,Add-Exports-Private=java.base/jdk.internal.misc  ");
+
+        // run with multiple values
+        runExpectingPass("Main-Class=Test1,Add-Exports-Private=java.base/jdk.internal.misc"
+                + " java.base/jdk.internal.loader");
+        runExpectingPass("Main-Class=Test1,Add-Exports-Private=java.base/jdk.internal.loader"
+                + " java.base/jdk.internal.misc");
     }
 
     /**