RFR: 8362237: IllegalArgumentException in the launcher when exception without stack trace is thrown [v2]

Christian Stein cstein at openjdk.org
Wed Jul 16 17:41:28 UTC 2025


On Tue, 15 Jul 2025 21:45:15 GMT, ExE Boss <duke at openjdk.org> wrote:

>> Christian Stein has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add null checks for getStackTrace() results
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/SourceLauncher.java line 266:
> 
>> 264:             Throwable cause = exception.getCause();
>> 265:             if (cause == null) throw exception;
>> 266:             StackTraceElement[] elements = cause.getStackTrace();
> 
> Note that `Throwable​::getStackTrace()` is not `final`, so it can be made to return `null` by overriding.
> Suggestion:
> 
>             StackTraceElement[] elements = cause.getStackTrace();
>             if (elements == null) throw exception;

Thanks for the suggestion. I added this and another null check in https://github.com/openjdk/jdk/pull/26315/commits/c7d4bbf9eba2b24bf8f15272024a74caa4ef0faa

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26315#discussion_r2211084212


More information about the compiler-dev mailing list