JDK-8207143 : jpackager fails to parse file associations
  • Type: Bug
  • Component: tools
  • Sub-Component: jpackage
  • Affected Version: internal
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-07-11
  • Updated: 2019-03-22
  • Resolved: 2018-07-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
internalFixed
Related Reports
Relates :  
Description
When I try to create installer on Windows with file associations, jpackager will fail with error below.

jpackager create-installer --verbose --input E:\Temp\output\jar --output output --name Test9 --vendor Alexander --description JavaApplication1 --main-jar JavaApplication1.jar --class javaapplication1.JavaApplication1 --files JavaApplication1.jar --jvm-args -Djnlp.TestName=Test9 --file-associations E:\Temp\output\prop\fileAssociation0.properties

Bundler MSI Installer skipped because of a configuration problem: java.lang.IllegalArgumentException: Param file-associations
 should be of type interface java.util.List but is a class java.util.HashMap

fileAssociation0.properties contains:
extension=test1
mime-type=application-x/test1
description="Test Extension 1"
icon=E:\Temp\output\icon\Test1.ico
Comments
webrev: http://cr.openjdk.java.net/~herrick/8207143/webrev.00/
17-07-2018

second part should be easy, setOptionValue will add to the existing value if the valueType is String, List, or Map, but only if the arg is listed in "multi_args", the set of args that are allowed multiple instances.
16-07-2018

I have a fix for the first part of this: --- a/src/jdk.packager/share/classes/jdk/packager/internal/Arguments.java +++ b/src/jdk.packager/share/classes/jdk/packager/internal/Arguments.java @@ -278,8 +278,13 @@ 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); + }), Now I can make one file association work, but we really want to make multiple associations work too. (with just this change it will overwrite each association with the next one specified.)
16-07-2018