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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

com.atlassian.jira.rest.client.api.domain.Issue.getIssueLinks() returns null unexpectedly Edited

the javadoc for com.atlassian.jira.rest.client.api.domain.Issue.getIssueLinks() says it returns issue links for this issue (possibly nothing) or null when issue links are deactivated for this JIRA instance

now, in our instance (on JIRA 7.3.3), links are enabled, and we have issues that contain links.  but getIssueLinks() is returning null.  i'm wondering if there's some other setting (or if i'm doing it wrong).  here's my code snippet (the first branch is always invoked):

 

Promise<SearchResult> searchJqlPromise = jiraRestClient.getSearchClient().searchJql(this.getQuery(proj), ISSUES_PER_CALL, startAt, fieldSet);
for (Issue issue : searchJqlPromise.claim().getIssues()) {
if (null == issue.getIssueLinks()) {
System.err.println("for issue " + issue.getKey() + "; getIssueLinks() returned null");
} else {
for (IssueLink link : issue.getIssueLinks()) {
String targetKey = link.getTargetIssueKey();
System.err.println("for issue " + issue.getKey() + " there is a link with key " + targetKey);
}
}

thanks!

 I was using JRJC 3.0.0 but have now found 4.0.0 exhibits the same behaviour.

1 answer

For the benefit of all, I solved my own problem by trawling through the source code.

In the jiraRestClient.getSearchClient().searchJql() call  to fetch the issues, the last parameter is a set of Strings that specify the fields to return.  This set has to include "issuelinks" for getIssueLinks() to return the list.  ("*all" will also work). 

To reduce data transfer volume (I'm often retrieving 30,000 issues down a WAN) I had cut down the list of fields to the minimum.  Adding in the "issuelinks" explicitly has solved the problem.

JRJC team, you could maybe consider put a small caveat in the javadoc for getIssueLinks() along these lines.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you