-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fixes NullPointerException when accessing a FeignException's content #914
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
Fixes NullPointerException when accessing a FeignException's content #914
Conversation
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
|
@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. |
kdavisk6
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 I've just implemented the change to return an empty String rather than null. |
|
@robachmann Thank you for updating the PR and congrats on your first contribution. |
If the content of a FeignException is null,
contentUTF8()now returnsnullrather than throwing a NullPointerException.nullis chosen to allow possible future releases to return an empty optional rather than a blank String. Fixes #912