The org.springframework.web.client.DefaultRestClient#readWithMessageConverters method from spring-web:7.0.8 is hiding I/O Exceptions (SocketTimeouts from connectTimeout/readTimeout) as a RestClientException with an unrelated content-type incompatibility message:
throw new RestClientException("Error while extracting response for type [" + ResolvableType.forType(bodyType) + "] and content type [" + contentType + "]", cause);
For example a SocketTimeout exception triggered by a readTimeout set in a client configured with Accept/Content-Type headers for "application/json", throws a RestClientException with the message:
"Error while extracting response for type [MyServiceResponse] and content type [application/octet-stream]"
This message is misleading, causing confusion in the actual underlying issue. Ideally if the issue is I/O related, the readWithMessageConverters method should throw a ResourceAccessException with the proper message.
The
org.springframework.web.client.DefaultRestClient#readWithMessageConvertersmethod from spring-web:7.0.8 is hiding I/O Exceptions (SocketTimeouts from connectTimeout/readTimeout) as aRestClientExceptionwith an unrelated content-type incompatibility message:For example a SocketTimeout exception triggered by a readTimeout set in a client configured with Accept/Content-Type headers for "application/json", throws a
RestClientExceptionwith the message:This message is misleading, causing confusion in the actual underlying issue. Ideally if the issue is I/O related, the
readWithMessageConvertersmethod should throw aResourceAccessExceptionwith the proper message.