WebClient throws ClassCastException for bodyToMono(ParameterizedTypeReference)

Prior to this commit, the `WebClient` always throws a `ClassCastException`
when an error occurs in `bodyToMono(ParameterizedTypeReference)``, and
not the expected exception, as set up by `onStatus`

Issue: SPR-16025
This commit is contained in:
Arjen Poutsma
2017-09-29 10:15:40 +02:00
parent d332e06f6c
commit 69945f4185
2 changed files with 24 additions and 4 deletions

View File

@@ -418,7 +418,7 @@ class DefaultWebClient implements WebClient {
public <T> Mono<T> bodyToMono(ParameterizedTypeReference<T> typeReference) {
return this.responseMono.flatMap(
response -> bodyToPublisher(response, BodyExtractors.toMono(typeReference),
mono -> (Mono<T>)mono));
this::monoThrowableToMono));
}
private <T> Mono<T> monoThrowableToMono(Mono<? extends Throwable> mono) {