issue.get("comment") don't work as expected

Dmitry November 17, 2015

Hi,

I'm using JIRA Misc Custom Fields 1.7.0 with JIRA v7.0.0#70107. Always get NullPointerException when I'm trying to issue.get("comment") for a List<> of comments. Full formula is:

<!-- @@Formula:
int numComments = issue.get("comment").size();
if(numComments > 0)
{
return (issue.get("comment")).get(size-1).getUpdated();
}
else
{
return new Date(issue.get("updated"));
}
-->

and eval of first string throws an exception. Issue have several comments. Tried in different ways, results in nothing, so your's advice wanted. Thanks!

7 answers

1 vote
David _old account_
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.
November 18, 2015

This is in fact a bug in JIRA Misc Custom Field 1.7.0 (and 1.6.3). It is tracked at: https://innovalog.atlassian.net/browse/JMCF-196

The bug is already fixed and a new release is on the way.

Sorry for the inconvenience,

David

David _old account_
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.
November 18, 2015

Version 1.7.1 is released.

Dmitry November 18, 2015

Thanks a lot!

0 votes
David _old account_
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.
November 17, 2015

I'm looking into it.

0 votes
Dmitry November 17, 2015

P.S.: Initial formula have an error, "get(size-1)", I've fixed to "get(numComments-1)", but it don't help.

0 votes
Dmitry November 17, 2015

Yes. But some of the issues from table-view filter (which includes this custom field) may not have comments.

0 votes
David _old account_
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.
November 17, 2015

And you confirm that issue CUTMAN-5 has at least one comment, right?

0 votes
Dmitry November 17, 2015

I don't get a stack trace but the following messages 2015-11-18 11:42:50,667 http-nio-8080-exec-4 ERROR dmitry.shaidaev 702x2823x2 16k788g 185.36.63.236,185.36.63.206,0:0:0:0:0:0:0:1 /rest/issueNav/1/issueTable [c.i.jmcf.fields.CalculatedDateField] CalculatedDateField: error evaluating formula of field "Last Commented" of issue CUTMAN-5: Sourced file: inline evaluation of: `` int numComments = issue.get("comment").size(); if(numComments > 0) { retur . . . '' : Typed variable declaration : at Line: 2 : in file: inline evaluation of: `` int numComments = issue.get("comment").size(); if(numComments > 0) { retur . . . '' : .size ( ) Target exception: java.lang.NullPointerException: Attempt to invoke method size on null value Navigate to the following URL to edit the formula: https://octonus-teams.com/cutjira/secure/admin/EditCustomField!default.jspa?id=12821 In c:\Atlassian\Data\JIRA\log\atlassian-jira.log

0 votes
David _old account_
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.
November 17, 2015

Can you post the full error (with stack trace) you found in your log file?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events