Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

NullPointer exception for issueLinkManager.createIssueLink

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?

 

Capture.PNG

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events