RFR: 8316964: Security tools should not call System.exit [v3]
Valerie Peng
valeriep at openjdk.org
Wed Oct 18 17:00:24 UTC 2023
On Mon, 16 Oct 2023 14:37:03 GMT, Weijun Wang <weijun at openjdk.org> wrote:
>> src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java line 155:
>>
>>> 153: private static void exit(int exitCode) {
>>> 154: throw new ExitException(exitCode);
>>> 155: }
>>
>> I don't see much benefit of this method since it's one-line to one-line. For other classes, it seems that value 0 is ok, but here an exception is thrown regardless of exit code value. Is this really intended?
>
> I'll inline the throw statements.
>
> Yes, no matter if it's zero or not. Throwing the exception makes sure it jumps back to `run` immediately. If the code is 0, then the `main` method will return normally.
Hmm, interesting usage. Thanks for the explanation.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15951#discussion_r1364229675
More information about the security-dev
mailing list