--- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java 2019-09-06 15:54:24.021682500 -0400 +++ new/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java 2019-09-06 15:54:22.009050300 -0400 @@ -74,7 +74,6 @@ "(?:(?:([\"'])(?:\\\\\\1|.)*?(?:\\1|$))|(?:\\\\[\"'\\s]|[^\\s]))++"); private DeployParams deployParams = null; - private String packageType = null; private int pos = 0; private List argList = null; @@ -119,8 +118,6 @@ deployParams = new DeployParams(); - packageType = null; - allOptions = new ArrayList<>(); addLaunchers = new ArrayList<>(); @@ -129,8 +126,7 @@ // CLIOptions is public for DeployParamsTest public enum CLIOptions { PACKAGE_TYPE("package-type", OptionCategories.PROPERTY, () -> { - context().packageType = popArg(); - context().deployParams.setTargetFormat(context().packageType); + context().deployParams.setTargetFormat(popArg()); }), INPUT ("input", "i", OptionCategories.PROPERTY, () -> { @@ -530,9 +526,9 @@ } private void validateArguments() throws PackagerException { - String packageType = deployParams.getTargetFormat(); - String ptype = (packageType != null) ? packageType : "default"; - boolean imageOnly = (packageType == null); + String type = deployParams.getTargetFormat(); + String ptype = (type != null) ? type : "default"; + boolean imageOnly = deployParams.isTargetAppImage(); boolean hasAppImage = allOptions.contains( CLIOptions.PREDEFINED_APP_IMAGE); boolean hasRuntime = allOptions.contains( @@ -550,7 +546,7 @@ if (imageOnly) { if (!ValidOptions.checkIfImageSupported(option)) { throw new PackagerException("ERR_InvalidTypeOption", - option.getIdWithPrefix(), packageType); + option.getIdWithPrefix(), type); } } else if (installerOnly || runtimeInstaller) { if (!ValidOptions.checkIfInstallerSupported(option)) { @@ -579,18 +575,27 @@ } private jdk.jpackage.internal.Bundler getPlatformBundler() { - String bundleType = (packageType == null ? "IMAGE" : "INSTALLER"); + boolean appImage = deployParams.isTargetAppImage(); + String type = deployParams.getTargetFormat(); + String bundleType = (appImage ? "IMAGE" : "INSTALLER"); + jdk.jpackage.internal.Bundler savedBundler = null; for (jdk.jpackage.internal.Bundler bundler : Bundlers.createBundlersInstance().getBundlers(bundleType)) { - if ((packageType == null) || - packageType.equalsIgnoreCase(bundler.getID())) { - if (bundler.supported(runtimeInstaller)) { + if (bundler.supported(runtimeInstaller)) { + if (type == null) { + if (bundler.isDefault()) { + return bundler; + } else { + savedBundler = bundler; + } + } else if (appImage || + type.equalsIgnoreCase(bundler.getID())) { return bundler; } } } - return null; + return savedBundler; } private void generateBundle(Map params)