RFR: 8316964: Security tools should not call System.exit [v3]
Weijun Wang
weijun at openjdk.org
Mon Oct 16 16:23:57 UTC 2023
On Sat, 14 Oct 2023 00:00:52 GMT, Valerie Peng <valeriep at openjdk.org> wrote:
>> Weijun Wang has updated the pull request incrementally with one additional commit since the last revision:
>>
>> typo
>
> 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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15951#discussion_r1360764046
More information about the security-dev
mailing list