Skip to content

Ignore null HttpMessageConverter in RestTemplate and HttpMessageConverterExtractor #23132

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

Closed
wants to merge 1 commit into from

Conversation

fodil-a
Copy link
Contributor

@fodil-a fodil-a commented Jun 13, 2019

Prior to this commit, if a null HttpMessageConverter was configured
in the RestTemplate, this would lead to a NullPointerException once
the list of converters was accessed.

This commit avoids such exceptions by ignoring null converters.

See gh-23123

If a null message converter is passed, restTemplate.postForObject will
throw a NullPointerException.
Checks are done to ensure it does not.

Signed-off-by: Rusty <[email protected]>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 13, 2019
@sbrannen sbrannen added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jun 14, 2019
@sbrannen sbrannen changed the title method postForObject in RestTemplate causes NPE Ignore null HttpMessageConverter in RestTemplate Jun 14, 2019
@sbrannen sbrannen changed the title Ignore null HttpMessageConverter in RestTemplate Ignore null HttpMessageConverter in RestTemplate and HttpMessageConverterExtractor Jun 14, 2019
@sbrannen sbrannen self-assigned this Jun 14, 2019
@sbrannen sbrannen added this to the 5.2 RC1 milestone Jun 14, 2019
@sbrannen
Copy link
Member

Tentatively slated for 5.2 RC1 and considering whether to backport to 5.1.x.

@fodil-a
Copy link
Contributor Author

fodil-a commented Jun 15, 2019

Please use PR at #23140.

I needed to change the fork's branch.

@fodil-a fodil-a closed this Jun 15, 2019
@sbrannen
Copy link
Member

Superseded by #23140

@sbrannen sbrannen removed this from the 5.2 RC1 milestone Jun 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants