Skip to content

Preserve I/O errors in RestClient body extraction - #37100

Open
zanarellidev wants to merge 1 commit into
spring-projects:mainfrom
zanarellidev:fix/restclient-preserve-io-exceptions
Open

Preserve I/O errors in RestClient body extraction#37100
zanarellidev wants to merge 1 commit into
spring-projects:mainfrom
zanarellidev:fix/restclient-preserve-io-exceptions

Conversation

@zanarellidev

@zanarellidev zanarellidev commented Aug 1, 2026

Copy link
Copy Markdown

Summary

DefaultRestClient.readWithMessageConverters was wrapping IOException / UncheckedIOException as RestClientException with a content-type extraction message, which made socket timeouts look like conversion failures.

I/O causes are now thrown as ResourceAccessException (already used elsewhere in this class for I/O). HttpMessageNotReadableException keeps the existing content-type message. Backward compatible for callers catching RestClientException since ResourceAccessException extends it.

Closes gh-37078

Test plan

  • New unit tests in DefaultRestClientTests for IOException, UncheckedIOException, and HttpMessageNotReadableException paths
  • ./gradlew :spring-web:test --tests DefaultRestClientTests green

readWithMessageConverters wrapped IOException and UncheckedIOException
in a RestClientException whose message blamed content-type extraction,
hiding timeouts and other I/O failures. Re-throw those as
ResourceAccessException (still a RestClientException subclass).

Closes spring-projectsgh-37078

Signed-off-by: zanarelli <zanarelli.dev@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged or decided on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants