RFR: 8372301: Improve error message for jimage command line tool regarding version mismatch [v3]

Roger Riggs rriggs at openjdk.org
Thu Jan 29 16:44:54 UTC 2026


On Wed, 26 Nov 2025 16:46:41 GMT, David Beaumont <duke at openjdk.org> wrote:

>> Adds a semantic reason for failure which can be optionally interrogated by calling code.
>> Use the 'Reason.BAD_VERSION' value to trigger a different translated error message from the JImageTask.
>> 
>> I would consider moving the error message string into the Reason enum to simplify the code triggering the error and avoid message string duplication, but it's not straightforward due to the need to supply the version numbers.
>> 
>> We can use this approach to provide translated messages for all the distinct failure reasons if needed.
>
> David Beaumont has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Redo bad indentation
>  - undo blank line

Yes,  make the prefix of the exception message a fixed value so it can be recognized with String.startsWith(...).
The caller already knows the name of the image and since the remedy is to use the matching Java install, that doesn't need any parameters.  (The actual jimage version values are meaningless at this point).
In addition to the generic action, the message from the exception could be provided, but mostly for debug but is not actionable.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/28456#issuecomment-3818897333


More information about the core-libs-dev mailing list