On Fri, 13 Feb 2026 20:59:09 GMT, David Beaumont <[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 already imports 
jdk.tools.jlink.internal classes so adding an exception to this package is okay.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29723#discussion_r2807179766

Reply via email to