-
Notifications
You must be signed in to change notification settings - Fork 27
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
[JENKINS-63355] Prevent NPEs when library name is not provided #101
base: master
Are you sure you want to change the base?
Conversation
src/main/java/org/jenkinsci/plugins/workflow/libs/LibraryConfiguration.java
Outdated
Show resolved
Hide resolved
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.
So what happens if a library with a null name was saved before this change? @LocalData
@@ -184,7 +191,7 @@ public FormValidation doCheckDefaultVersion(@AncestorInPath Item context, @Query | |||
} else { | |||
for (LibraryResolver resolver : ExtensionList.lookup(LibraryResolver.class)) { | |||
for (LibraryConfiguration config : resolver.fromConfiguration(Stapler.getCurrentRequest())) { | |||
if (config.getName().equals(name)) { | |||
if (name.equals(config.getName())) { |
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.
could be reverted
@@ -177,7 +180,7 @@ public static class Execution extends AbstractSynchronousNonBlockingStepExecutio | |||
if (retriever == null) { | |||
for (LibraryResolver resolver : ExtensionList.lookup(LibraryResolver.class)) { | |||
for (LibraryConfiguration cfg : resolver.forJob(run.getParent(), Collections.singletonMap(name, version))) { | |||
if (cfg.getName().equals(name)) { | |||
if (name.equals(cfg.getName())) { |
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.
ditto
Actually still fails. Need to rework this. We need to skip those libraries. But probably also tell the user about it. |
JENKINS-63355 Prevent NPEs in cases where the library name is not provided (if a library without name is accessible - in the context of a pipeline - then the
library
step would fail with a NPE, regardless of the library it tries to find)Testing done
Submitter checklist