JDK-8170120 jimage IOException solution?

Alan Bateman Alan.Bateman at oracle.com
Fri Feb 16 13:17:18 UTC 2018


On 16/02/2018 13:03, Michal Vala wrote:
> 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.
Why can't you just catch the IOException and adds the exception message 
to the error message that jimage prints?

-Alan


More information about the jigsaw-dev mailing list