Wrap IOException as HttpMessageNotReadableException for RestTemplate usage
In the 4.3.x line, conversion exceptions do not get wrapped as RestClientException yet, so the expectation remains to receive a HttpMessageNotReadableException for conversion-level IOExceptions. Issue: SPR-13592
This commit is contained in:
@@ -219,7 +219,7 @@ public abstract class AbstractJackson2HttpMessageConverter extends AbstractGener
|
||||
return readJavaType(javaType, inputMessage);
|
||||
}
|
||||
|
||||
private Object readJavaType(JavaType javaType, HttpInputMessage inputMessage) throws IOException {
|
||||
private Object readJavaType(JavaType javaType, HttpInputMessage inputMessage) {
|
||||
try {
|
||||
if (inputMessage instanceof MappingJacksonInputMessage) {
|
||||
Class<?> deserializationView = ((MappingJacksonInputMessage) inputMessage).getDeserializationView();
|
||||
@@ -233,6 +233,9 @@ public abstract class AbstractJackson2HttpMessageConverter extends AbstractGener
|
||||
catch (JsonProcessingException ex) {
|
||||
throw new HttpMessageNotReadableException("JSON parse error: " + ex.getOriginalMessage(), ex);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new HttpMessageNotReadableException("I/O error while reading input message", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user