RFR: 8316964: Security tools should not call System.exit
Weijun Wang
weijun at openjdk.org
Tue Oct 3 22:29:48 UTC 2023
On Tue, 3 Oct 2023 21:06:44 GMT, ExE Boss <duke at openjdk.org> wrote:
>> Remove most `System.exit()` calls in various security tools and only leave one in the `main` method. This paves the way to convert them to JSR 199 tools.
>
> src/java.base/share/classes/sun/security/tools/keytool/Main.java line 433:
>
>> 431: }
>> 432: } catch (ExitException ee) {
>> 433: throw ee;
>
> `ExitException` is a private inner class, so external users won’t be able to distinguish it from a regular `Exception` to extract the `errorCode`.
Yes, you are right. I should modify `run` to return an integer and make `ExitException` completely internal.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15951#discussion_r1344806434
More information about the security-dev
mailing list