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

Swap equals check around to prevent NPE #289

Closed
wants to merge 3 commits into from

Conversation

demaniak
Copy link
Contributor

@demaniak demaniak commented May 3, 2016

Swapped equals check on strings around to prevent NPE and let the code handle the missing header condition as intended.

Swapped equals check on strings around to prevent NPE and let the code handle the missing header condition as intended.
@demaniak
Copy link
Contributor Author

demaniak commented May 3, 2016

This should prevent the NPE mentioned in #287

It will of course not magically make the missing header appear :)

@coder-hugo
Copy link
Contributor

I don't like this type of comparing strings. As this changes the meaning of the "if-sentence". The current code says: I want to know if the value of the variable eventHeader is (equals) Merge Request Hook or Push Hook. Your code says: I want to know if Merge Request Hook or Push Hook is the value of the variable eventHeader.
Jenkins has already the apache commons-lang as a dependency so we should use the StringUtils for a null-safe and syntactical correct equals check.

@coder-hugo
Copy link
Contributor

Can you just squash your commits to a single one then I'll merge this PR back.

@demaniak
Copy link
Contributor Author

demaniak commented May 9, 2016

@coder-hugo oke-doke, I will try to get to that during today.

@demaniak
Copy link
Contributor Author

demaniak commented May 9, 2016

huh, @coder-hugo find myself unsure how to safely squash the commits (never done before, and I quickly settle this before going home)

I'm just going to close this PR, and re-submit with single commit.

@demaniak demaniak closed this May 9, 2016
@demaniak demaniak deleted the safe-string-comparison branch May 9, 2016 16:01
exceed-alae pushed a commit to exceed-alae/gitlab-plugin that referenced this pull request May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants