RFR: 8204256: improve jlink error message to report unsupported class file format [v2]

Ian Graves igraves at openjdk.java.net
Mon Oct 5 18:57:52 UTC 2020


On Fri, 2 Oct 2020 21:54:07 GMT, Mandy Chung <mchung at openjdk.org> wrote:

>> What if we removed the handling of specific exceptions from L278-L285 so that the special handling is limited to
>> BadArgs? If anything other than BadArgs is throw then it can print the exception to log output along with the cause (if
>> not null). No objection. That might avoid the tool emitting a "scary" stack trace when an error occurs.
>
> I think for `ResolutionException` and IAE (and possibly `PluginException`), the exception message should be helpful
> enough to correct for example user-errors and that's why this special catch block.
> Having another look, I think `FindException` may just fall into the last `Throwable` handler.   The new catch block may
> not be needed.

I noticed that the `Thorowable` catchall case at the bottom was there, but kept the `FindException` as a distinct block
because the other exceptions exit with a different error code. Catching the `FindException` at the top level is
technically not an abnormal termination, but a "normal" error case.  Does this matter all that much?

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

PR: https://git.openjdk.java.net/jdk/pull/409


More information about the core-libs-dev mailing list