-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Labels
Description
How to reproduce: interrupt the waiting thread in the middle of CountDownLatch.await
try {
cont.suspendAndAwaitResume();
} catch (InterruptedException e) {
Utils.throwAsUnchecked(e.getCause());
return null;
}
InterruptedException.cause
is null
.
throw null
produces NPE.
PS:
Utils.throwAsUnchecked(e.getCause());
return null;
can also be optimized into one line
public static <E extends Throwable> **RuntimeException** throwAsUnchecked(Throwable t) throws E {
throw (E) t;
}
after it, use:
throw Utils.throwAsUnchecked(e);
PPS: and "happy path" for aready competed Futures
default T await() {
if (isComplete()) {
return ...
}
PR: #4958