gitlab-plugin icon indicating copy to clipboard operation
gitlab-plugin copied to clipboard

Fix an NPE in certain declarative pipelines

Open scottashipp opened this issue 5 years ago • 3 comments

Fixes a NullPointerException that can occur on declarative pipelines using triggers options but neglecting to pass a value for the branchFilterType option.

Resolves the following observed NPE (taken from Jenkins logs):

Error while serving https://xyz.abc.aws.com/project/my-project
java.lang.NullPointerException
	at com.dabsquared.gitlabjenkins.trigger.filter.BranchFilterFactory.newBranchFilter(BranchFilterFactory.java:15)
	at com.dabsquared.gitlabjenkins.GitLabPushTrigger.initializeBranchFilter(GitLabPushTrigger.java:492)
	at com.dabsquared.gitlabjenkins.GitLabPushTrigger.onPost(GitLabPushTrigger.java:448)
	at com.dabsquared.gitlabjenkins.webhook.build.MergeRequestBuildAction$1.performOnPost(MergeRequestBuildAction.java:78)
	at com.dabsquared.gitlabjenkins.webhook.build.BuildWebHookAction$TriggerNotifier.run(BuildWebHookAction.java:54)
	at hudson.security.ACL.impersonate(ACL.java:350)
	at com.dabsquared.gitlabjenkins.webhook.build.MergeRequestBuildAction.execute(MergeRequestBuildAction.java:75)
	at com.dabsquared.gitlabjenkins.webhook.build.BuildWebHookAction.execute(BuildWebHookAction.java:31)
	at com.dabsquared.gitlabjenkins.webhook.GitLabWebHook.getDynamic(GitLabWebHook.java:44)
	at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:710)
	at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:396)
        ....

scottashipp avatar Aug 28 '20 21:08 scottashipp

18 monthes later ...

facing same issue. At least a workaround exists or still have to bang my head against a brick wall ?

loganmzz avatar Feb 08 '22 09:02 loganmzz

@MarkEWaite Can you please review and merge this? I am running into it.

brd avatar Oct 15 '22 20:10 brd

@MarkEWaite Can you please review and merge this? I am running into it.

@brd have you confirmed that the change fixes your issue and does not have undesirable side effects?

MarkEWaite avatar Oct 15 '22 21:10 MarkEWaite

This fix makes a lot of sense to me just by studying the code alone.

krisstern avatar Jan 31 '23 13:01 krisstern

@krisstern You’re welcome

scottashipp avatar Jan 31 '23 14:01 scottashipp