RFR: 8312436: CompletableFuture never completes when 'Throwable.toString()' method throws Exception

Chen Liang liach at openjdk.org
Fri May 10 14:42:23 UTC 2024


On Sun, 28 Apr 2024 09:54:34 GMT, Viktor Klang <vklang at openjdk.org> wrote:

> Primarily offering this PR for discussion, as Throwables throwing exceptions on toString(), getLocalizedMessage(), or getMessage() seems like a rather unreasonable thing to do.
> 
> Nevertheless, there is some things we can do, as witnessed in this PR.

src/java.base/share/classes/java/util/concurrent/CompletableFuture.java line 310:

> 308: 
> 309:     static CompletionException wrapInCompletionException(Throwable t) {
> 310:         if (t == null)

Is there any preexisting code path that ever passes a null? If not I don't think this check is necessary.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18988#discussion_r1582947192


More information about the core-libs-dev mailing list