JDK-8170120 jimage IOException solution?

Michal Vala mvala at redhat.com
Fri Feb 16 13:03:32 UTC 2018


Hi,

I'm working on JDK-8170120[1]. I have 2 working solutions, but I'm not happy 
with neither one.

That IOException is thrown from jdk.internal.jimage.BasicImageReader, which is 
in java.base module. Jimage is implemented in jdk.jlink module 
(jdk.tools.jimage.JImageTask).

One solution is new exception NotValidJimageException which can be thrown from 
BasicImageReader and catch and handled at JImageTask. Then it's easy to return 
proper error message to the output.
Issue is that this new exception has to be public in java.base so de-facto 
defining new jdk core api, which of course I don't want to.

Next option is leave there IOException, but give it some known message and then 
handle this message in JImageTask.
This work also well, but "parsing" some message from exception is a bit clumsy.


Opinions or other ideas?

[1] - https://bugs.openjdk.java.net/browse/JDK-8170120

-- 
Michal Vala
OpenJDK QE
Red Hat Czech


More information about the jigsaw-dev mailing list