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

David Beaumont duke at openjdk.org
Tue Feb 17 12:51:05 UTC 2026


On Tue, 17 Feb 2026 12:48:25 GMT, David Beaumont <duke at openjdk.org> wrote:

>> New implementation of improved JImageTask error message using string matching to detect the "version mismatch" error without needing code changes in the library.
>> 
>> Added tests for the error message and other ways in which the jimage file can be corrupt.
>
> David Beaumont has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Back to original idea of special case exception

After offline discussions, the original approach of have a custom exception to capture this case is being used.

src/jdk.jlink/share/classes/jdk/tools/jimage/JImageTask.java line 438:

> 436:                 }
> 437:             } catch (IOException ioe) {
> 438:                 boolean isVersionMismatch = ioe instanceof BasicImageReader.ImageVersionMismatchException;

Or I can have a separate catch block. Either is fine by me.

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

PR Comment: https://git.openjdk.org/jdk/pull/29723#issuecomment-3914529043
PR Review Comment: https://git.openjdk.org/jdk/pull/29723#discussion_r2816868380


More information about the core-libs-dev mailing list