I am getting a null pointer for issueLinkManager.createIssueLink even though all the parameters of the API are not null. I am printing the parameters 1 by 1 and none of them is null.
Here is my code:
void createFeature(Issue issue, List<String> componentList){def issueLinkManager = ComponentAccessor.issueLinkManagerdef authenticationContext = ComponentAccessor.jiraAuthenticationContextdef issueFactory = ComponentAccessor.getIssueFactory()def issueManager = ComponentAccessor.getIssueManager()def userManager = ComponentAccessor.getUserUtil() def currentUserObj = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();long issueLinkType= 10070long sequence =1long newissueTypeID= 19long myissueID= issue.getId()MutableIssue newissue= ComponentAccessor.issueFactory.issue//set valuesnewissue.setProjectObject(issue.projectObject)newissue.setIssueTypeId("19") newissue.setSummary("MOUNA CAMELIA")newissue.setDescription("MOUNA CAMELIA")newissue.reporter = issue.getReporter()def newIssueCreated = issueManager.createIssueObject(currentUserObj, newissue)long newIssueCreatedID= newIssueCreated.getId() for(String component: componentList){ log.warn("MOUNA CAMELIA ===== myissueID ====="+ myissueID+" =====newissueTypeID ====="+newIssueCreated.getId() +" =====issueLinkType ====="+issueLinkType +" =====sequence ====="+ sequence +" =====authenticationContext.getLoggedInUser() ====="+authenticationContext.getLoggedInUser() +"issuelinkmanager===="+issueLinkManager) issueLinkManager.createIssueLink(myissueID, newIssueCreatedID, issueLinkType, sequence, authenticationContext.getLoggedInUser()) }}
I printed the values of all the parameters in my log and none of them is null as you can see below:
MOUNA CAMELIA ===== myissueID =====1521112 =====newissueTypeID =====1782817 =====issueLinkType =====10070 =====sequence =====1 =====authenticationContext.getLoggedInUser() =====mouh(JIRAUSER65000)issuelinkmanager====com.atlassian.jira.issue.link.DefaultIssueLinkManager@49e3bd37
Yet, I am receiving a null pointer exception as you can see here, anyone knows what causes this problem?