Skip to content

Handling null in BufferingClientHttpResponseWrapper #886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

jmnarloch
Copy link
Contributor

BufferingClientHttpResponseWrapper#getBody brakes the contract for ClientHttpResponse and whenever the response body is null (for instance when 204 is being returned) it throws IllegalArgumentException, while any other implementation is returning null.

@jhoeller
Copy link
Contributor

I'm picking this up in SPR-13563, clarifying getBody's contract there. I'm wondering whether the null return value is actually intended, since the interface javadoc doesn't mention it, and the only implementation ever returning null seems to be HttpComponents(Async)ClientHttpResponse. All the others seem to return an empty body instead, or am I missing something?

@jhoeller
Copy link
Contributor

Resolved through SPR-13563. Please reopen that JIRA issue if there is anything left to be addressed.

@jhoeller jhoeller closed this Oct 12, 2015
@jmnarloch
Copy link
Contributor Author

Cool, thanks!

The IAE was exactly what we were struggling with, but your solution is way more elegant.

Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants