8207143: jpackager fails to parse file associations JDK-8200758-branch
authorherrick
Tue, 17 Jul 2018 10:54:15 -0400
branchJDK-8200758-branch
changeset 56836 40abf95122b0
parent 56835 43caa6ff671a
child 56837 d63675085e09
8207143: jpackager fails to parse file associations Reviewed-by: almatvee, asemenyuk
src/jdk.packager/share/classes/jdk/packager/internal/Arguments.java
src/jdk.packager/share/classes/jdk/packager/internal/DeployParams.java
--- a/src/jdk.packager/share/classes/jdk/packager/internal/Arguments.java	Fri Jul 13 10:41:07 2018 -0400
+++ b/src/jdk.packager/share/classes/jdk/packager/internal/Arguments.java	Tue Jul 17 10:54:15 2018 -0400
@@ -278,8 +278,14 @@
                 args.put(StandardBundlerParam.FA_ICON.getID(), icon);
             }
 
+            ArrayList<Map<String, ? super Object>> associationList =
+                new ArrayList<Map<String, ? super Object>>();
+
+            associationList.add(args);
+
             // check that we really add _another_ value to the list
-            setOptionValue("file-associations", args);
+            setOptionValue("file-associations", associationList);
+
         }),
 
         SECONDARY_LAUNCHER ("secondary-launcher",
--- a/src/jdk.packager/share/classes/jdk/packager/internal/DeployParams.java	Fri Jul 13 10:41:07 2018 -0400
+++ b/src/jdk.packager/share/classes/jdk/packager/internal/DeployParams.java	Tue Jul 17 10:54:15 2018 -0400
@@ -568,19 +568,21 @@
             StandardBundlerParam.ADD_MODULES.getID(),
             StandardBundlerParam.LIMIT_MODULES.getID(),
             StandardBundlerParam.STRIP_NATIVE_COMMANDS.getID(),
+            StandardBundlerParam.FILE_ASSOCIATIONS.getID(),
             JLinkBundlerHelper.DETECT_MODULES.getID()
     ));
 
     @SuppressWarnings("unchecked")
     public void addBundleArgument(String key, Object value) {
         // special hack for multi-line arguments
-        if (multi_args.contains(key) && value instanceof String) {
+        if (multi_args.contains(key)) {
             Object existingValue = bundlerArguments.get(key);
-            if (existingValue instanceof String) {
+            if (existingValue instanceof String && value instanceof String) {
                 bundlerArguments.put(key, existingValue + "\n\n" + value);
-            } else if (existingValue instanceof List) {
-                ((List)existingValue).add(value);
-            } else if (existingValue instanceof Map && ((String)value).contains("=")) {
+            } else if (existingValue instanceof List && value instanceof List) {
+                ((List)existingValue).addAll((List)value);
+            } else if (existingValue instanceof Map &&
+                value instanceof String && ((String)value).contains("=")) {
                 String[] mapValues = ((String)value).split("=", 2);
                 ((Map)existingValue).put(mapValues[0], mapValues[1]);
             } else {