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 JENKINS-26452] Prevent NPE if no publisher in conditional step. #7
Conversation
…e conditional step. This also prevents a NPE when the job loads.
Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests |
// This can happen if the projects publisher list was removed, returning | ||
// a list with one null element. | ||
if (publisherList.contains(null)) { | ||
publisherList.remove(null); |
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.
Better done in readResolve
.
While the changes here seem fine as a robustness improvement, I feel like something is missing. How could the UI form be submitting a list with null elements to begin with? The reproduction step
should just result in an empty list if standard form binding is being used, and that should be harmless. |
… the test unit to test readResolve method.
The problem was the |
Looks almost perfect to me. Thanks.
|
In the long term it would be better to get rid of the |
Sorry about the whitespace changes. I thought I had fixed my IDE to not make these changes. |
FlexiblePublisher fp = new FlexiblePublisher(Arrays.asList(conditionalPublisher)); | ||
p.getPublishersList().add(fp); | ||
p.save(); | ||
jenkins.reload(); |
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.
BTW another way of doing this is to use @LocalData
with a prepared example of historically broken configuration.
👍 |
[FIXED JENKINS-26452] Prevent NPE if no publisher in conditional step.
Thanks for the pull request! |
Oh... I had to release as 0.13.1 (that means fix for 0.13)... |
JENKINS-26452
If there are no publishers added to the flexible publish plugin, then the plugin can throw a NPE when saving, executing a build, and restarting Jenkins will fail to load the job.
@reviewbybees