-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Avoid NPE at using MutableProjectConfig #5869
Conversation
@@ -55,7 +55,7 @@ public MutableProjectConfig() { | |||
|
|||
@Override | |||
public String getName() { | |||
return name; | |||
return name != null ? name : ""; |
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.
@RomanNikitenko just FYI - com.google.common.base.Strings#nullToEmpty
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.
@azatsarynnyy thank you, I've fixed it!
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/3245/ |
@azatsarynnyy @vparfonov I've changed checks for null: com.google.common.base.MoreObjects#firstNonNull instead of com.google.common.base.Strings#nullToEmpty because of in this case this one allows to avoid NPE for collections as well as for string or any object. |
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/3247/ |
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
ca84e96
to
35aebec
Compare
What does this PR do?
We have constructor for MutableProjectConfig without parameters here
and the fields are not initialized in this case.
These changes allow to avoid NPE in different places on client side where we use MutableProjectConfig
Changelog
Avoid NPE at using MutableProjectConfig
Signed-off-by: Roman Nikitenko rnikiten@redhat.com