|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2017 the original author or authors. |
|
|
|
* Copyright 2002-2019 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -16,6 +16,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
package org.springframework.web.servlet.mvc.method.annotation; |
|
|
|
package org.springframework.web.servlet.mvc.method.annotation; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.concurrent.CompletionException; |
|
|
|
import java.util.concurrent.CompletionStage; |
|
|
|
import java.util.concurrent.CompletionStage; |
|
|
|
import java.util.function.BiFunction; |
|
|
|
import java.util.function.BiFunction; |
|
|
|
|
|
|
|
|
|
|
|
@ -93,6 +94,9 @@ public class DeferredResultMethodReturnValueHandler implements HandlerMethodRetu |
|
|
|
DeferredResult<Object> result = new DeferredResult<>(); |
|
|
|
DeferredResult<Object> result = new DeferredResult<>(); |
|
|
|
future.handle((BiFunction<Object, Throwable, Object>) (value, ex) -> { |
|
|
|
future.handle((BiFunction<Object, Throwable, Object>) (value, ex) -> { |
|
|
|
if (ex != null) { |
|
|
|
if (ex != null) { |
|
|
|
|
|
|
|
if (ex instanceof CompletionException && ex.getCause() != null) { |
|
|
|
|
|
|
|
ex = ex.getCause(); |
|
|
|
|
|
|
|
} |
|
|
|
result.setErrorResult(ex); |
|
|
|
result.setErrorResult(ex); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
|