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

Fixed a reverse label null check #308

Merged
merged 1 commit into from
Mar 21, 2022

Conversation

gaspardpetit
Copy link
Contributor

I'm not sure what the impact of this really is - but the check is definitely reversed.

if (requiredResources.label != null && requiredResources.label.isEmpty())

should have been:

if (requiredResources.label == null || requiredResources.label.isEmpty())

But I fixed it with a StringUtils.isBlank(requiredResources.label)

I notice the plugin has a lot of x == null || x.isEmpty() or similar and would encourage to use StringUtils.isBlank and StringUtils.isNotBlank for these checks. They are far less error-prone and easier to read.

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

Should have been label == null || label.isEmpty() - using StringUtils.isBlank for improved readability
@gaspardpetit
Copy link
Contributor Author

gaspardpetit commented Feb 9, 2022

From what I see, label will never be null - (it is set to "" when it is) so this change should have no impact (other than making the check semantically correct)

@jimklimov jimklimov merged commit 6aa87c2 into jenkinsci:master Mar 21, 2022
@basil
Copy link
Member

basil commented May 7, 2022

Released in 2.15.

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