On Sat, 14 Feb 2026 07:59:52 GMT, Alan Bateman <[email protected]> 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.
>
> src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java line
> 200:
>
>> 198: result.getMinorVersion() != ImageHeader.MINOR_VERSION) {
>> 199: // We rely on the sub-string "not the correct version" to
>> detect
>> 200: // version issues in JImageTask and give a better user
>> message.
>
> Is there any reason not to introduce an ImageVersionMismatchException
> (extends IOException) to avoid depending on the message text? The jimage tool
> already imports jdk.internal.jimage classes so adding an exception to this
> package is okay.
Discussing offline. See also:
https://github.com/openjdk/jdk/pull/28456/files/aa40f0c711cf5c02a243bda01d2e2d40d4b2b352#r2550365590
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29723#discussion_r2814027930