Skip to content

Commit

Permalink
8234867: Issue warning for mutually exclusive options on jpackage com…
Browse files Browse the repository at this point in the history
…mand line

Reviewed-by: prr, asemenyuk, almatvee
  • Loading branch information
Andy Herrick committed Dec 10, 2019
1 parent 28099d7 commit 2c772c7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
Expand Up @@ -565,11 +565,24 @@ private void validateArguments() throws PackagerException {
}
}
}
if (installerOnly && hasRuntime) {
// note --runtime-image is only for image or runtime installer.
throw new PackagerException("ERR_InvalidTypeOption",
CLIOptions.PREDEFINED_RUNTIME_IMAGE.getIdWithPrefix(),
ptype);
if (hasRuntime) {
if (hasAppImage) {
// note --runtime-image is only for image or runtime installer.
throw new PackagerException("ERR_MutuallyExclusiveOptions",
CLIOptions.PREDEFINED_RUNTIME_IMAGE.getIdWithPrefix(),
CLIOptions.PREDEFINED_APP_IMAGE.getIdWithPrefix());
}
if (allOptions.contains(CLIOptions.ADD_MODULES)) {
throw new PackagerException("ERR_MutuallyExclusiveOptions",
CLIOptions.PREDEFINED_RUNTIME_IMAGE.getIdWithPrefix(),
CLIOptions.ADD_MODULES.getIdWithPrefix());
}
if (allOptions.contains(CLIOptions.BIND_SERVICES)) {
throw new PackagerException("ERR_MutuallyExclusiveOptions",
CLIOptions.PREDEFINED_RUNTIME_IMAGE.getIdWithPrefix(),
CLIOptions.BIND_SERVICES.getIdWithPrefix());
}

}
if (hasMainJar && hasMainModule) {
throw new PackagerException("ERR_BothMainJarAndModule");
Expand Down
Expand Up @@ -72,6 +72,7 @@ ERR_NoMainClass=Error: Main application class is missing
ERR_UnsupportedOption=Error: Option [{0}] is not valid on this platform
ERR_InvalidTypeOption=Error: Option [{0}] is not valid with type [{1}]
ERR_NoInstallerEntryPoint=Error: Option [{0}] is not valid without --module or --main-jar entry point option
ERR_MutuallyExclusiveOptions="Error: Mutually exclusive options [{0}] and [{1}]

ERR_MissingArgument=Error: Missing argument: {0}
ERR_MissingAppResources=Error: No application jars found
Expand Down
Expand Up @@ -72,6 +72,7 @@ ERR_NoMainClass=Error: Main application class is missing
ERR_UnsupportedOption=Error: Option [{0}] is not valid on this platform
ERR_InvalidTypeOption=Error: Option [{0}] is not valid with type [{1}]
ERR_NoInstallerEntryPoint=Error: Option [{0}] is not valid without --module or --main-jar entry point option
ERR_MutuallyExclusiveOptions="Error: Mutually exclusive options [{0}] and [{1}]

ERR_MissingArgument=Error: Missing argument: {0}
ERR_MissingAppResources=Error: No application jars found
Expand Down
Expand Up @@ -72,6 +72,7 @@ ERR_NoMainClass=Error: Main application class is missing
ERR_UnsupportedOption=Error: Option [{0}] is not valid on this platform
ERR_InvalidTypeOption=Error: Option [{0}] is not valid with type [{1}]
ERR_NoInstallerEntryPoint=Error: Option [{0}] is not valid without --module or --main-jar entry point option
ERR_MutuallyExclusiveOptions="Error: Mutually exclusive options [{0}] and [{1}]

ERR_MissingArgument=Error: Missing argument: {0}
ERR_MissingAppResources=Error: No application jars found
Expand Down

0 comments on commit 2c772c7

Please sign in to comment.