--- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java 2019-04-19 16:02:13.032788162 -0700 +++ new/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java 2019-04-19 16:02:12.736788170 -0700 @@ -167,19 +167,33 @@ (s, p) -> s ); + static final StandardBundlerParam PREDEFINED_RUNTIME_IMAGE = + new StandardBundlerParam<>( + Arguments.CLIOptions.PREDEFINED_RUNTIME_IMAGE.getId(), + File.class, + params -> null, + (s, p) -> new File(s) + ); + static final StandardBundlerParam APP_NAME = new StandardBundlerParam<>( Arguments.CLIOptions.NAME.getId(), String.class, params -> { String s = MAIN_CLASS.fetchFrom(params); - if (s == null) return null; - - int idx = s.lastIndexOf("."); - if (idx >= 0) { - return s.substring(idx+1); + if (s != null) { + int idx = s.lastIndexOf("."); + if (idx >= 0) { + return s.substring(idx+1); + } + return s; + } else if (isRuntimeInstaller(params)) { + File f = PREDEFINED_RUNTIME_IMAGE.fetchFrom(params); + if (f != null) { + return f.getName(); + } } - return s; + return null; }, (s, p) -> s ); @@ -229,7 +243,7 @@ ); @SuppressWarnings("unchecked") - static final StandardBundlerParam> JVM_OPTIONS = + static final StandardBundlerParam> JAVA_OPTIONS = new StandardBundlerParam<>( Arguments.CLIOptions.JAVA_OPTIONS.getId(), (Class>) (Object) List.class, @@ -301,15 +315,6 @@ (s, p) -> s ); - static final StandardBundlerParam PREFERENCES_ID = - new StandardBundlerParam<>( - "preferencesID", - String.class, - p -> Optional.ofNullable(IDENTIFIER.fetchFrom(p)). - orElse("").replace('.', '/'), - (s, p) -> s - ); - static final StandardBundlerParam VERBOSE = new StandardBundlerParam<>( Arguments.CLIOptions.VERBOSE.getId(), @@ -343,13 +348,6 @@ params -> null, (s, p) -> new File(s)); - static final StandardBundlerParam PREDEFINED_RUNTIME_IMAGE = - new StandardBundlerParam<>( - Arguments.CLIOptions.PREDEFINED_RUNTIME_IMAGE.getId(), - File.class, - params -> null, - (s, p) -> new File(s)); - @SuppressWarnings("unchecked") static final StandardBundlerParam>> ADD_LAUNCHERS = new StandardBundlerParam<>( @@ -718,17 +716,8 @@ } mainJarFile = new File(mainJarValue); if (mainJarFile.exists()) { - // absolute path for main-jar may fail is only legal if - // path is within the appResourceRoot directory - try { - return new RelativeFileSet(appResourcesRoot, - new LinkedHashSet<>(Collections.singletonList( - mainJarFile))); - } catch (Exception e) { - // if not within, RelativeFileSet constructor throws a - // RuntimeException, but the IllegalArgumentException - // below contains a more explicit error message. - } + // absolute path for main-jar may fail is not legal + // below contains explicit error message. } else { List modulePath = MODULE_PATH.fetchFrom(params); modulePath.removeAll(getDefaultModulePath());