File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
integration/kotlinx-coroutines-jdk8/src/future Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -95,15 +95,15 @@ public fun <T> CompletionStage<T>.asDeferred(): Deferred<T> {
95
95
} catch (e: Throwable ) {
96
96
// unwrap original cause from ExecutionException
97
97
val original = (e as ? ExecutionException )?.cause ? : e
98
- CompletableDeferred <T >().also { it.cancel (original) }
98
+ CompletableDeferred <T >().also { it.completeExceptionally (original) }
99
99
}
100
100
}
101
101
val result = CompletableDeferred <T >()
102
102
whenComplete { value, exception ->
103
103
if (exception == null ) {
104
104
result.complete(value)
105
105
} else {
106
- result.cancel (exception)
106
+ result.completeExceptionally (exception)
107
107
}
108
108
}
109
109
if (this is Future <* >) result.cancelFutureOnCompletion(this )
You can’t perform that action at this time.
0 commit comments