You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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.issueLinkManager
def authenticationContext = ComponentAccessor.jiraAuthenticationContext
def issueFactory = ComponentAccessor.getIssueFactory()
def issueManager = ComponentAccessor.getIssueManager()
def userManager = ComponentAccessor.getUserUtil()
def currentUserObj = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
long issueLinkType= 10070
long sequence =1
long newissueTypeID= 19
long myissueID= issue.getId()
MutableIssue newissue= ComponentAccessor.issueFactory.issue
//set values
newissue.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?