jenkinsci/atlassian-jira-software-cloud-plugin

NPE if issueKeys is bad

jimklimov opened this issue · 1 comments

Hi, while setting up a parser of issueKeys from branch names (similar to discussion at e.g. #41) I did not get the correct strings from regex matcher at first, which JIRA would resolve to issues eventually (e.g. passed feature/ or / to this field), and this caused the plugin to dereference a null pointer:

java.lang.NullPointerException
	at com.atlassian.jira.cloud.jenkins.deploymentinfo.service.JiraDeploymentInfoSenderImpl.handleDeploymentApiResponse(JiraDeploymentInfoSenderImpl.java:212)
	at com.atlassian.jira.cloud.jenkins.deploymentinfo.service.JiraDeploymentInfoSenderImpl.sendDeploymentInfo(JiraDeploymentInfoSenderImpl.java:158)
	at com.atlassian.jira.cloud.jenkins.deploymentinfo.pipeline.JiraSendDeploymentInfoStep$JiraSendDeploymentInfoStepExecution.run(JiraSendDeploymentInfoStep.java:218)
	at com.atlassian.jira.cloud.jenkins.deploymentinfo.pipeline.JiraSendDeploymentInfoStep$JiraSendDeploymentInfoStepExecution.run(JiraSendDeploymentInfoStep.java:186)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

I traced this to

probably trying to look into response.getAcceptedDeployments() without checking if response itself is null?

Hey @jimklimov,

this should be fixed in version 2.0 of the plugin, as the field in question is automatically initialized to an empty list if null is passed in.

However, version 2.0 of the plugin requires to install the new Jenkins for Jira app into you Jira, as documented here.

Let me know if this helps.