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 when trying to execute issueLinkManager.createIssueLink

I am executing the following code in my scriptrunner console for Jira data center.

 

Capture.PNG

 

Here is the code: 


import com.atlassian.jira.issue.Issue

import com.atlassian.jira.component.ComponentAccessor

import com.atlassian.jira.issue.MutableIssue

def issueManager = ComponentAccessor.issueManager

def issueFactory = ComponentAccessor.issueFactory

def issueLinkManager = ComponentAccessor.issueLinkManager

def userManager = ComponentAccessor.userManager

def authenticationContext = ComponentAccessor.jiraAuthenticationContext

MutableIssue newIssue= ComponentAccessor.issueFactory.issue

log.warn(authenticationContext.getLoggedInUser())

issueLinkManager.createIssueLink(1521112 as long , 1782819 as long, 10070 as long, 1 as long, authenticationContext.getLoggedInUser())

I am getting a null pointer exception for the last line 
issueLinkManager.createIssueLink(1521112 as long , 1782819 as long, 10070 as long, 1 as long, authenticationContext.getLoggedInUser())

although none of the parameters is null. The error message is not telling me what the problem is. Anyone knows what to do in order to fix this problem? I am just trying to have a new feature issue linked to the superfeature main issue.  

1 answer

0 votes
Hauke Bruno Wollentin
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.
Sep 21, 2023

I'd guess that one of the given objects (either one of the issues or the link itself) doesn't exist.

You can try to cross-check this while loading the corresponding objects with your given IDs, for example

issueManager.getIssueObject(1521112)
issueManager.getIssueObject(1782819)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events