SIL Script causes exceptions

Any idea why this script causes exceptions?


string[] lastCommentDetails = getLastComment(key);

    if(userHasAccessToComment(currentUser(), lastCommentDetails["id"])){
       return userFullName(lastCommentDetails["author"]) + ": " + lastCommentDetails["text"];
return "";
2017-05-09 10:35:16,596 http-nio-8080-exec-20 ERROR magdalena.kwater 635x85267x2 j8x0q8 /secure/AjaxIssueAction.jspa [c.k.j.p.keplercf.silscriptcf.SilScriptCFType] Exception occurred while executing SIL Script for custom field Default Configuration for Last Comment on issue LOG-361
com.keplerrominfo.sil.lang.SILException: Exception while executing SIL program >>SIL Script CF-11201<<: [SIL Error on line: 4, column: 8] Null comment >>NaN<<
	at com.keplerrominfo.refapp.sil.impl.AbstractSimpleLanguageService.interpret(
	at sun.reflect.GeneratedMethodAccessor807.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
Caused by: com.keplerrominfo.sil.lang.SILException: Null comment >>NaN<<
	at com.keplerrominfo.jira.commons.ivm.routines.perms.UserHasAccessToCommentRoutine.executeRoutine(

1 answer

It would appear that this line of code is being assigned a null value:

string[] lastCommentDetails = getLastComment(key);

Then, as you try to access data from the lastCommentDetails variable (which is null), a null pointer exception is being thrown:

if(userHasAccessToComment(currentUser(), lastCommentDetails["id"]))

Is it possible that the key you pass into the function isn't assosiated with any last comment? In other words, is there a last comment with that given key?

There might be an issue without comment... 

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,338 views 14 20
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot