Skip to content

RestClient readWithMessageConverters method hiding I/O Exceptions with incorrect error message. #37078

Description

@Nicolas-Miranda

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: webIssues in web modules (web, webmvc, webflux, websocket)status: waiting-for-triageAn issue we've not yet triaged or decided on

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions