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

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

This widget could not be displayed.

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

Version 1.7.1 is released.

Thanks a lot!

This widget could not be displayed.

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

This widget could not be displayed.

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

This widget could not be displayed.

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

This widget could not be displayed.

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

This widget could not be displayed.

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

This widget could not be displayed.

I'm looking into it.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

525 views 3 19
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you