Skip to content
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

Merged
merged 1 commit into from
Aug 3, 2017

Conversation

RomanNikitenko
Copy link
Member

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

@RomanNikitenko RomanNikitenko added the kind/bug Outline of a bug - must adhere to the bug report template. label Aug 2, 2017
@RomanNikitenko RomanNikitenko added this to the 5.16.0 milestone Aug 2, 2017
@@ -55,7 +55,7 @@ public MutableProjectConfig() {

@Override
public String getName() {
return name;
return name != null ? name : "";
Copy link
Member

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

Copy link
Member Author

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!

@codenvy-ci
Copy link

@RomanNikitenko
Copy link
Member Author

@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.

@codenvy-ci
Copy link

Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Outline of a bug - must adhere to the bug report template.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants