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 NPE when setting selector explicitly to null from groovy #200

Conversation

cconnert
Copy link
Contributor

When doing e.g.

def selector = someCondition ? specific(BUILD)) : null;
copyArtifacts(fingerprintArtifacts: true, selector: selector, projectName: "someProject")

leads to:

Also:   org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: xyz
java.lang.NullPointerException
	at hudson.plugins.copyartifact.CopyArtifact.perform(CopyArtifact.java:482)
	at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:101)
	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:71)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

though I would expect to get the default (aka. stable) artifact selector.

Testing done

No, please add a dedicated unit test

Submitter checklist

@cconnert cconnert requested a review from a team as a code owner August 10, 2023 08:28
@cconnert cconnert force-pushed the bugfix/NPE_when_selector_set_null_from_groovy branch from 17762da to 0a8c964 Compare August 10, 2023 08:35
@allancth allancth merged commit 3d31132 into jenkinsci:master Aug 11, 2023
15 checks passed
@MarkEWaite MarkEWaite added the bug label Aug 24, 2023
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.

3 participants