Strange Script Runner errors during Re-index of Jira 6.3.1 system

AndreH August 11, 2014

I am getting the following errors during a re-index of the system with Jira 6.3.1.

I can't find anything related to the error - userKey should not be null!

here are the complete errors in the logs -

2014-08-11 15:35:54,868 IssueIndexer:thread-3 ERROR ahughes 933x5998x1 1k1hgkv 1.1.1.1 /secure/admin/IndexReIndex.jspa [onresolve.scriptrunner.customfield.GroovyCustomField] userKey should not be null!

com.atlassian.jira.util.dbc.Assertions$NullArgumentException: userKey should not be null!

at com.atlassian.jira.util.dbc.Assertions.notNull(Assertions.java:29)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySetForUserKey(DefaultUserPropertyManager.java:44)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySet(DefaultUserPropertyManager.java:38)

at com.atlassian.jira.user.UserPropertyManager$getPropertySet$1.call(Unknown Source)

at Script2.run(Script2.groovy:11)

2014-08-11 15:35:54,875 IssueIndexer:thread-3 ERROR ahughes 933x5998x1 1k1hgkv 1.1.1.1 /secure/admin/IndexReIndex.jspa [onresolve.scriptrunner.customfield.GroovyCustomField] userKey should not be null!

com.atlassian.jira.util.dbc.Assertions$NullArgumentException: userKey should not be null!

at com.atlassian.jira.util.dbc.Assertions.notNull(Assertions.java:29)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySetForUserKey(DefaultUserPropertyManager.java:44)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySet(DefaultUserPropertyManager.java:38)

at com.atlassian.jira.user.UserPropertyManager$getPropertySet$1.call(Unknown Source)

at Script10.run(Script10.groovy:11)

2014-08-11 15:35:54,918 IssueIndexer:thread-3 ERROR ahughes 933x5998x1 1k1hgkv 1.1.1.1 /secure/admin/IndexReIndex.jspa [onresolve.scriptrunner.customfield.GroovyCustomField] userKey should not be null!

com.atlassian.jira.util.dbc.Assertions$NullArgumentException: userKey should not be null!

at com.atlassian.jira.util.dbc.Assertions.notNull(Assertions.java:29)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySetForUserKey(DefaultUserPropertyManager.java:44)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySet(DefaultUserPropertyManager.java:38)

at com.atlassian.jira.user.UserPropertyManager$getPropertySet$1.call(Unknown Source)

at Script24.run(Script24.groovy:11)

2014-08-11 15:35:55,493 IssueIndexer:thread-1 ERROR ahughes 933x5998x1 1k1hgkv 1.1.1.1 /secure/admin/IndexReIndex.jspa [onresolve.scriptrunner.customfield.GroovyCustomField] userKey should not be null!

com.atlassian.jira.util.dbc.Assertions$NullArgumentException: userKey should not be null!

at com.atlassian.jira.util.dbc.Assertions.notNull(Assertions.java:29)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySetForUserKey(DefaultUserPropertyManager.java:44)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySet(DefaultUserPropertyManager.java:38)

at com.atlassian.jira.user.UserPropertyManager$getPropertySet$1.call(Unknown Source)

at Script2.run(Script2.groovy:11)

2014-08-11 15:35:55,498 IssueIndexer:thread-1 ERROR ahughes 933x5998x1 1k1hgkv 1.1.1.1 /secure/admin/IndexReIndex.jspa [onresolve.scriptrunner.customfield.GroovyCustomField] userKey should not be null!

com.atlassian.jira.util.dbc.Assertions$NullArgumentException: userKey should not be null!

at com.atlassian.jira.util.dbc.Assertions.notNull(Assertions.java:29)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySetForUserKey(DefaultUserPropertyManager.java:44)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySet(DefaultUserPropertyManager.java:38)

at com.atlassian.jira.user.UserPropertyManager$getPropertySet$1.call(Unknown Source)

at Script10.run(Script10.groovy:11)

2014-08-11 15:35:55,524 IssueIndexer:thread-1 ERROR ahughes 933x5998x1 1k1hgkv 1.1.1.1 /secure/admin/IndexReIndex.jspa [onresolve.scriptrunner.customfield.GroovyCustomField] userKey should not be null!

com.atlassian.jira.util.dbc.Assertions$NullArgumentException: userKey should not be null!

at com.atlassian.jira.util.dbc.Assertions.notNull(Assertions.java:29)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySetForUserKey(DefaultUserPropertyManager.java:44)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySet(DefaultUserPropertyManager.java:38)

at com.atlassian.jira.user.UserPropertyManager$getPropertySet$1.call(Unknown Source)

at Script24.run(Script24.groovy:11)

2014-08-11 15:43:39,472 IssueIndexer:thread-6 ERROR ahughes 933x5998x1 1k1hgkv 1.1.1.1 /secure/admin/IndexReIndex.jspa [onresolve.scriptrunner.customfield.GroovyCustomField] userKey should not be null!

com.atlassian.jira.util.dbc.Assertions$NullArgumentException: userKey should not be null!

at com.atlassian.jira.util.dbc.Assertions.notNull(Assertions.java:29)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySetForUserKey(DefaultUserPropertyManager.java:44)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySet(DefaultUserPropertyManager.java:38)

at com.atlassian.jira.user.UserPropertyManager$getPropertySet$1.call(Unknown Source)

at Script2.run(Script2.groovy:11)

2014-08-11 15:43:39,484 IssueIndexer:thread-6 ERROR ahughes 933x5998x1 1k1hgkv 1.1.1.1 /secure/admin/IndexReIndex.jspa [onresolve.scriptrunner.customfield.GroovyCustomField] userKey should not be null!

com.atlassian.jira.util.dbc.Assertions$NullArgumentException: userKey should not be null!

at com.atlassian.jira.util.dbc.Assertions.notNull(Assertions.java:29)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySetForUserKey(DefaultUserPropertyManager.java:44)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySet(DefaultUserPropertyManager.java:38)

at com.atlassian.jira.user.UserPropertyManager$getPropertySet$1.call(Unknown Source)

at Script10.run(Script10.groovy:11)

2014-08-11 15:43:39,515 IssueIndexer:thread-6 ERROR ahughes 933x5998x1 1k1hgkv 1.1.1.1 /secure/admin/IndexReIndex.jspa [onresolve.scriptrunner.customfield.GroovyCustomField] userKey should not be null!

com.atlassian.jira.util.dbc.Assertions$NullArgumentException: userKey should not be null!

at com.atlassian.jira.util.dbc.Assertions.notNull(Assertions.java:29)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySetForUserKey(DefaultUserPropertyManager.java:44)

at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySet(DefaultUserPropertyManager.java:38)

at com.atlassian.jira.user.UserPropertyManager$getPropertySet$1.call(Unknown Source)

at Script24.run(Script24.groovy:11)

4 answers

1 accepted

0 votes
Answer accepted
AndreH August 25, 2014

I found out what the issue was - We have a custom user field named Customer and the scripted reads the public user properties from these users. Several entries had the users login I.D. set instead of the full name.

example Customer: asmith

Should have been set to Customer: Smith, Abby

Once it was changed to the full name, the errors are gone

JamieA
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.
August 26, 2014

The most recent release has better and more concise error messages for script field failures.

1 vote
Alexey_Rjeutski__Polontech_
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.
August 11, 2014

For the second field (Read and Display User Properties on Main Issues)

replace

propValue = userPropertyManager.getPropertySet(dirUser)?.getString('jira.meta.'+propKey);

with

if (null != dirUser)
    propValue = userPropertyManager.getPropertySet(dirUser)?.getString('jira.meta.'+propKey);

and try to reindex again

Alexey_Rjeutski__Polontech_
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.
August 11, 2014

if that didn't help:

try {
   propValue = userPropertyManager.getPropertySet(dirUser)?.getString('jira.meta.'+propKey);
} catch (Exception e) {
 //ignore nullpointer
}

AndreH August 12, 2014

I tried both methods and neither worked

1 vote
Alexey_Rjeutski__Polontech_
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.
August 11, 2014

Most possible you've deleted some user that was used in configuration of the script custom field. You should review your existing script field and check if they contain proper data. Do you use those fields at all? Please check https://jamieechlin.atlassian.net/wiki/display/GRV/Scripted+Fieldsfor details

AndreH August 11, 2014

3.) Display Previous Issue Key Number

import com.atlassian.jira.ComponentManager

def componentManager = ComponentManager.getInstance()

def changeHistoryManager = componentManager.getChangeHistoryManager()

x = changeHistoryManager.getPreviousIssueKeys(issue.id)

if (x.join(' ') == "") {

return null

}

return x.join(' ')

4.) Display Parent Issue Custom Numeric Field on Sub-tasks

import com.atlassian.jira.issue.Issue;

import com.atlassian.jira.ComponentManager;

import com.atlassian.jira.issue.CustomFieldManager;

import com.atlassian.jira.issue.fields.CustomField;

import com.atlassian.jira.component.ComponentAccessor;

field = ComponentAccessor.getCustomFieldManager().getCustomFieldObject('customfield_13000')

if (issue.isSubTask())

{

def abc456 = issue.getParentObject().getCustomFieldValue(field);

return abc456

}

return null;

5.) Display Parent Issue Custom Date field on Sub-Tasks

import com.atlassian.jira.issue.Issue;

import com.atlassian.jira.ComponentManager;

import com.atlassian.jira.issue.CustomFieldManager;

import com.atlassian.jira.issue.fields.CustomField;

import com.atlassian.jira.component.ComponentAccessor;

field = ComponentAccessor.getCustomFieldManager().getCustomFieldObject('customfield_11401')

if (issue.isSubTask())

{

def abc456 = issue.getParentObject().getCustomFieldValue(field);

return abc456

}

return null;

AndreH August 11, 2014

I haven't deleted any users used in the configuration.

Here are the scripted fields setup -

1.) Display Parent Issue Attachments on Sub-tasks

2.) Read and Display User Properties on Main Issues

3.) Display Previous Issue Key Number

4.) Display Parent Issue Custom Numeric Field on Sub-tasks

5.) Display Parent Issue Custom Date field on Sub-Tasks

And here is the code for each -

1) Display Parent Issue Attachments on Sub-tasks

import com.atlassian.jira.issue.attachment.Attachment;

import com.atlassian.jira.issue.Issue;

import com.atlassian.jira.ComponentManager;

String s = "";

if(null != issue.parentObject)

{

for(Attachment att : issue.parentObject.attachments)

{

s = s +"<a href=\"" + ComponentManager.getInstance().getApplicationProperties().getString("jira.baseurl")+

"/secure/attachment/"+att.id+"/"+att.filename+"\">"+att.filename+"</a>" + "<br>";

}

}

return s;

2.) Read and Display User Properties on Main Issues

import com.atlassian.jira.user.ApplicationUsers;

import com.atlassian.crowd.embedded.api.User;

import com.atlassian.jira.component.ComponentAccessor;

import com.atlassian.jira.user.UserPropertyManager;

UserPropertyManager userPropertyManager = ComponentAccessor.getUserPropertyManager();

String propKey = "public Location";

String propValue = null;

def u = getCustomFieldValue('Customer')

if (u) {

def dirUser = ApplicationUsers.toDirectoryUser(u)

propValue = userPropertyManager.getPropertySet(dirUser)?.getString('jira.meta.'+propKey);

}

return propValue;

0 votes
JamieA
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.
August 18, 2014

As Alexey said, it looks like the problem is that a user has been renamed.

What version of the plugin are you using?

AndreH August 18, 2014

I am using groovyrunner-3.0.3

JamieA
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.
August 18, 2014

It needs to have better error messages than that, I'll look into it.

Suggest an answer

Log in or Sign up to answer