Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

My Plugin won't work in every Jira environment

Maja Stach May 14, 2013

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

0 votes
Michal Husar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 14, 2013

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 ?

0 votes
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 14, 2013

While line is throwing NPE?

0 votes
Maja Stach May 14, 2013

right, sorry

0 votes
Maja Stach May 14, 2013

right. sorry 'bout that

0 votes
codelab expert
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 14, 2013

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events