Skip to content

JENKINS-61474 Improve null safety of the tool step#302

Merged
jtnord merged 1 commit intojenkinsci:masterfrom
duemir:JENKINS-61474
Mar 5, 2024
Merged

JENKINS-61474 Improve null safety of the tool step#302
jtnord merged 1 commit intojenkinsci:masterfrom
duemir:JENKINS-61474

Conversation

@duemir
Copy link
Member

@duemir duemir commented Mar 5, 2024

Tools page doesn't prevent submission of empty tool names. Some tools (e.g. Allure Commandline) use Util.fixEmptyAndTrim on the name, so there is a possibility of NPE when comparing the tool names. By flipping the comparison we avoid NPE since tool step requires name argument.

This most likely fixes https://issues.jenkins.io/browse/JENKINS-61474

Testing done

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

Tools page doesn't prevent submission of empty tool names. Some tools (e.g. Allure Commandline) use `Util.fixEmptyAndTrim` on the name, so there is a possibility of NPE when comparing the tool names. By flipping the comparison we avoid NPE since `tool` step requires `name` argument.
@duemir duemir requested a review from a team as a code owner March 5, 2024 05:06
@jtnord jtnord added the bug label Mar 5, 2024
Copy link
Member

@jtnord jtnord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some tools (e.g. Allure Commandline) use Util.fixEmptyAndTrim on the name

sounds like a UX bug should be filed for these plugins? How does that render / work in dropdowns etc...

@jtnord jtnord merged commit 257ae6b into jenkinsci:master Mar 5, 2024
@duemir duemir deleted the JENKINS-61474 branch March 5, 2024 23:38
@duemir
Copy link
Member Author

duemir commented Mar 5, 2024

@jtnord it is either shown as blank item if plugin stores it as empty string or as null:

2024-03-06-tool-snippet-generator

@jtnord
Copy link
Member

jtnord commented Mar 6, 2024

@jtnord it is either shown as blank item if plugin stores it as empty string or as null:

2024-03-06-tool-snippet-generator

please file bugs for the plugins that support null or the blank string then that you are aware of (or a general one for Jenkins core to prevent this - but this would break those tools installation definitions if/when merged without plugin changes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants