Skip to content

Conversation

@robachmann
Copy link
Contributor

If the content of a FeignException is null, contentUTF8() now returns null rather than throwing a NullPointerException. null is chosen to allow possible future releases to return an empty optional rather than a blank String. Fixes #912

If the content of a FeignException is null, `contentUTF8()` now returns `null` rather than throwing a NullPointerException. `null` is chosen to allow possible future releases to return an empty optional rather than a blank String. Fixes #912
…achmann/feign into gh-912-npe-in-feignexception

# Conflicts:
#	core/src/test/java/feign/FeignTest.java
@robachmann
Copy link
Contributor Author

@kdavisk6 I managed to implement a fix for the NPE and added a test for it. I hope I did everything correctly and am looking forward to your feedback.

Copy link
Member

@kdavisk6 kdavisk6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robachmann

This looks pretty, good, but I wanted to get your thoughts on returning an empty string instead of null from contentUTF8. We don't explicitly state what the contract is here, but I think we should consider return a String, even an empty one, from this method all the time. What do you think?

@kdavisk6 kdavisk6 added waiting for feedback Issues waiting for a response from either to the author or other maintainers bug Unexpected or incorrect behavior labels Mar 1, 2019
@robachmann
Copy link
Contributor Author

@kdavisk6 I've just implemented the change to return an empty String rather than null.

@kdavisk6 kdavisk6 removed the waiting for feedback Issues waiting for a response from either to the author or other maintainers label Mar 8, 2019
@kdavisk6
Copy link
Member

kdavisk6 commented Mar 8, 2019

@robachmann Thank you for updating the PR and congrats on your first contribution.

@kdavisk6 kdavisk6 merged commit 6b8ed38 into OpenFeign:master Mar 8, 2019
@kdavisk6 kdavisk6 added this to the 10.2.1 milestone Apr 28, 2019
velo pushed a commit that referenced this pull request Oct 7, 2024
…914)

Fixes NullPointerException when accessing a FeignException's content

Fixes #912 

If the content of a FeignException is null, `contentUTF8()` now returns an empty string rather than throwing a NullPointerException.
velo pushed a commit that referenced this pull request Oct 8, 2024
…914)

Fixes NullPointerException when accessing a FeignException's content

Fixes #912 

If the content of a FeignException is null, `contentUTF8()` now returns an empty string rather than throwing a NullPointerException.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected or incorrect behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NullPointerException if content in FeignException is null

2 participants