My Plugin won't work in every Jira environment

I've developed a Plugin which creates a copy of an Issue. It works just find when I use it on my localhost but doesn't when I try integrating it in our test environment.

I allways get a NullPointerException from the method that returns the IssueInputParameters for the new Issue.
I already thought of required fields which might not have been set.... but as far as I know I would get an InvalidCreationResult instad of a NullPointerException.

Does anyone know why I get this strange NullPointerException?

Code:

public IssueInputParameters newIssueParameters(String name){
		IssueInputParameters newParams = issueService.newIssueInputParameters();
		Collection<ProjectComponent> components =getCurrentIssue().getComponentObjects();
		List<Long> ids = new ArrayList<Long>();
		for(ProjectComponent comp : components)
			ids.add(comp.getId());
		Long[] array = new Long[ids.size()];
			newParams.setComponentIds(ids.toArray(array));
			newParams.setSummary(name);
			newParams.setProjectId(getCurrentIssue().getProjectObject().getId());
			newParams.setIssueTypeId(getCurrentIssue().getIssueTypeObject().getId());
		newParams.setAssigneeId(getLoggedInUser().getDisplayName());
			newParams.setPriorityId(getCurrentIssue().getPriorityObject().getId());
		newParams.setReporterId(getLoggedInUser().getDisplayName());

		return newParams;
	}

5 answers

Please post your code extract. So we can see what the reason for the error.

right. sorry 'bout that

right, sorry

0 vote

While line is throwing NPE?

2 Jobin:

I allways get a NullPointerException from the method that returns the IssueInputParameters for the new Issue.

So maybe it's this line?

IssueInputParameters newParams = issueService.newIssueInputParameters();

Is "issueService" != null ?

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published yesterday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

66 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you