Skip to content

Conversation

@alexeysemenyukoracle
Copy link
Member

@alexeysemenyukoracle alexeysemenyukoracle commented Nov 21, 2025

Some jpackage error messages have "Error: " prefix. Some don't. The prefix is redundant as jpackage assembles the error message from the localized "Error: " prefix and localized message body [1]. The prefix was removed.

There are error messages specific to jpackage options that duplicate generic error messages. They are:

ERR_BuildRootInvalid
It duplicates a generic "error.parameter-not-empty-directory" error message.

Specialized error message Generic error message
Error: temp (foo) must be non-existent or empty directory The value "foo" provided for parameter --temp is not an empty directory or non existent path

ERR_AppImageNotExist
It duplicates a generic "error.parameter-not-directory" error message.

Specialized error message Generic error message
Error: App image directory "foo" does not exist The value "foo" provided for parameter --app-image is not a directory

ERR_LicenseFileNotExit
It duplicates a generic "error.parameter-not-file" error message.

Specialized error message Generic error message
Error: Specified license file does not exist The value "foo" provided for parameter --license-file is not a file

ERR_BothMainJarAndModule
It duplicates a generic "ERR_MutuallyExclusiveOptions" error message.

Specialized error message Generic error message
Error: Cannot have both --main-jar and --module Options Mutually exclusive options [--main-jar] and [--module]

ERR_NoAddLauncherName
It duplicates a generic "error.parameter-add-launcher-malformed" error message.

Specialized error message Generic error message
Error: --add-launcher option requires a name and a file path (--add-launcher <name>=<file path>) The value "foo" provided for parameter --add-launcher does not match the pattern <name>=<file path>

Specialized error messages duplicating generic error messages were removed to simplify maintenance.

ERR_MissingArgument
ERR_MissingArgument was not referenced in the implementation, but was mistakenly referenced in the tests. It was replaced with ERR_MissingArgument2, and ERR_MissingArgument was removed.

error.invalid-option-value
"error.invalid-option-value" was used for errors in shortcut launcher options (--win-shortcut, --linux-shortcut), but it is not descriptive. For this reason, it was replaced with the "error.parameter-not-launcher-shortcut-dir".

Old error message New error message
Invalid value "foo" of option --linux-shortcut The value "foo" provided for parameter --linux-shortcut is not a valid shortcut startup directory

The wording of the new error message aligns with the wording of the error message jpackage will emit when it fails to parse "win-shortcut" or "linux-shortcut" property in an additional launcher property file (error.properties-parameter-not-launcher-shortcut-dir) which is:

The value "foo" provided for property "linux-shortcut" in "bar.properties" file is not a valid shortcut startup directory

Error messages that are not referenced in the code:

ID Note
message.creating-association-with-null-extension FA with null extensions are not supported starting from jdk25:
if (extensions == null || extensions.isEmpty()) {
Latest referenced from jdk21u/MacAppImageBuilder.java.
error.must-sign-app-store Latest referenced from jdk16/MacAppStoreBundler.java. It was removed, the key is a leftover.
error.must-sign-app-store.advice Same as "error.must-sign-app-store"
message.ignoring.symlink Last referenced from jdk24u/MacAppImageBuilder.java. The file was deleted in JDK-8333664.
message.already.signed Last refernced from jdk16/MacAppImageBuilder.java. The reference was removed in JDK-8248904.
message.running-script Last refernced from jdk14/MacDmgBundler.java. The reference was removed in JDK-8230652.
message.module-class Last refernced from jdk14/JLinkBundlerHelper.java. The reference was removed in JDK-8246624.
resource.setup-icon Referenced from jfx11u/WinExeBundler.java. Not referenced from any JDK repo.
message.invalid.install.dir Was referenced from WixAppImageFragmentBuilder.java until JDK-8333664. Duplicates "error.invalid-install-dir" referenced from
var ex = buildConfigException("error.invalid-install-dir", installDir).create();
resource.bundle-config-file Found only in .property files accross all repos in the "openjdk" org. Was never referenced.

Unreferenced error messages were removed.

Additionally, reworked ErrorTest to differentiate between error and advice messages in the jpackage output.

Compared the contents of "*Resources.properties" files before and after the change to verify there are no unexpected changes:

$ git checkout master
$ find open/src/jdk.jpackage/ -name '*Resources.properties' | xargs grep -hoE '^[^=]*=' | sort -u > old.txt
$ git checkout JDK-8372359
$ find open/src/jdk.jpackage/ -name '*Resources.properties' | xargs grep -hoE '^[^=]*=' | sort -u > new.txt
$ comm old.txt new.txt -3
ERR_AppImageNotExist=
ERR_BothMainJarAndModule=
ERR_BuildRootInvalid=
ERR_LicenseFileNotExit=
ERR_MissingArgument=
ERR_NoAddLauncherName=
error.invalid-option-value=
error.must-sign-app-store.advice=
error.must-sign-app-store=
        error.parameter-not-empty-directory=
message.already.signed=
message.creating-association-with-null-extension=
message.ignoring.symlink=
message.invalid.install.dir=
message.module-class=
message.running-script=
resource.bundle-config-file=
resource.setup-icon=

[1]

messagePrinter.accept(I18N.format("message.error-header", msg));


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8372359: Clean jpackage error messages (Enhancement - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28457/head:pull/28457
$ git checkout pull/28457

Update a local copy of the PR:
$ git checkout pull/28457
$ git pull https://git.openjdk.org/jdk.git pull/28457/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 28457

View PR using the GUI difftool:
$ git pr show -t 28457

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28457.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 21, 2025

👋 Welcome back asemenyuk! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Nov 21, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Nov 21, 2025

@alexeysemenyukoracle The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 21, 2025
@mlbridge
Copy link

mlbridge bot commented Nov 21, 2025

Webrevs

@alexeysemenyukoracle
Copy link
Member Author

@sashamatveev PTAL

@openjdk openjdk bot removed the rfr Pull request is ready for review label Nov 21, 2025
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-libs [email protected] rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

1 participant