Skip to content

Commit 6c74fee

Browse files
jonatan-ivanovsnicoll
authored andcommitted
Remove unnecessary error signal from DefaultRestClient
Before UnknownContentTypeException is thrown, it is added to the current Observation but since UnknownContentTypeException is a RestClientException, the exception is added again in one of the catch blocks later on. Closes gh-33347
1 parent 36e84a5 commit 6c74fee

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

spring-web/src/main/java/org/springframework/web/client/DefaultRestClient.java

+2-5
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,10 @@ private <T> T readWithMessageConverters(ClientHttpResponse clientResponse, Runna
220220
return (T) messageConverter.read((Class)bodyClass, responseWrapper);
221221
}
222222
}
223-
UnknownContentTypeException unknownContentTypeException = new UnknownContentTypeException(bodyType, contentType,
223+
224+
throw new UnknownContentTypeException(bodyType, contentType,
224225
responseWrapper.getStatusCode(), responseWrapper.getStatusText(),
225226
responseWrapper.getHeaders(), RestClientUtils.getBody(responseWrapper));
226-
if (observation != null) {
227-
observation.error(unknownContentTypeException);
228-
}
229-
throw unknownContentTypeException;
230227
}
231228
catch (UncheckedIOException | IOException | HttpMessageNotReadableException exc) {
232229
Throwable cause;

0 commit comments

Comments
 (0)