On Tue, 10 Oct 2023 21:11:21 GMT, Weijun Wang <wei...@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.
>> 
>> Note: before this change, the behavior of a successful `main()` method 
>> execution is not consistent. Sometimes the method returns silently, 
>> sometimes a `System.exit(0)` is called somewhere. After this change, the 
>> method always returns silently. This makes sure that existing programs that 
>> calls the `main` method directly will continue and does not exit the VM.
>
> Weijun Wang has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   typo

src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Ktab.java
 line 82:

> 80:     }
> 81: 
> 82:     private static class ExitException extends RuntimeException {

If we want to use ExitException as internal exception, perhaps it's easier to 
not extending RuntimeException? This way we can rely on compiler to flag all 
methods which throw it and handle it accordingly.

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?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15951#discussion_r1358982000
PR Review Comment: https://git.openjdk.org/jdk/pull/15951#discussion_r1358985633

Reply via email to