Filter not working. Error in Plugin Restart

Hello everyone

I just recently installed Script runner, but I am stuck with some issues.

First I wrote a little Script to search for all Issues that belong to projects where I am lead.

import com.atlassian.jira.ComponentManager

def componentManager = ComponentManager.getInstance()

if(issue.projectObject.leadUserName == componentManager.jiraAuthenticationContext? {
    return 1 as Double
return 0 as Double

In the preview it returns the correct value, But filtering always returns zero Issues. No matter if its filter= 1 or filter= 0 or even filter!= x.

Template is Number field

Configured searcher is Number Searcher

I got the log message stating it might not be started yet and reenabled the addon as described in other questions. During the enabling process I got the following Stacktrace.

2014-04-10 09:05:52,705 Thread-891 WARN dennis 545x27337x1 16jf7rm /rest/plugins/1.0/com.onresolve.jira.groovy.groovyrunner-key [onresolve.jira.groovy.ScriptManagerImpl] Failed to create searcher custom field. Can happen during upgrades.
com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.NullPointerException
	at com.atlassian.util.concurrent.LazyReference.getInterruptibly(
	at com.atlassian.util.concurrent.LazyReference.get(
	at com.atlassian.util.concurrent.ResettableLazyReference.get(
	at com.atlassian.jira.issue.fields.CustomFieldImpl.getCustomFieldSearcher(
	at com.atlassian.jira.issue.fields.CustomFieldImpl.<init>(
	at com.atlassian.jira.issue.fields.CustomFieldImpl.<init>(
	at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getCustomFieldsFromIds(
	at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getCustomFieldObjects(
	at com.atlassian.jira.issue.CustomFieldManager$ Source)
	at com.onresolve.jira.groovy.ScriptManagerImpl.createIndexingCustomField(ScriptManagerImpl.groovy:499)  <+3>
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(
	at groovy.lang.MetaMethod.doMethodInvoke(
	at groovy.lang.MetaClassImpl.invokeMethod(
	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN(
	at com.onresolve.jira.groovy.ScriptManagerImpl.this$dist$invoke$1(ScriptManagerImpl.groovy)
	at com.onresolve.jira.groovy.ScriptManagerImpl$1.methodMissing(ScriptManagerImpl.groovy)  <+3>
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(
	at groovy.lang.MetaClassImpl.invokeMissingMethod(
	at groovy.lang.MetaClassImpl.invokePropertyOrMissing(
	at groovy.lang.MetaClassImpl.invokeMethod(
	at groovy.lang.MetaClassImpl.invokeMethod(
	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(
	at com.onresolve.jira.groovy.ScriptManagerImpl$
	at Source)
Caused by: java.lang.NullPointerException
	at com.atlassian.jira.util.JiraUtils.loadComponent(
	at com.atlassian.jira.util.JiraUtils.loadComponent(
	at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.loadSearcher(
	at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getCustomFieldSearcher(
	at com.atlassian.jira.issue.fields.CustomFieldImpl$CustomFieldSearcherLazyRef.create(
	at com.atlassian.util.concurrent.ResettableLazyReference$InternalReference.create(
	at com.atlassian.util.concurrent.LazyReference$
	at com.atlassian.util.concurrent.LazyReference.getInterruptibly(
	... 32 more

I am working on Jira 6.2.2 - Script runner 2.1.17.

Thanks for any answer in advance

Dennis Hardy

2 answers

I have done some work on this for 3.0 and not seen this problem recently - as you are using jira 6.2+ can you give it a try? You can get it from here:

Thank you very much, this seems to work perfectly.I will get in touch in case I see any bugs in the new version.

----- Edit -----

I sadly already found a bug here. After I asked a colleague to try the new filter, he saw my projects, not his own.

that's not a bug... when you search jira uses the value stored in the lucene index, and the value will be generated by the person that last edits it.

So your approach won't work. Instead you could use a User template, and return the User object corresponding to the project lead.

However it would be better to write a jql function. Actually there already is one:

project in projectsLeadByUser()

I can confirm the beta release has fixed many of the problems that we were facing during startup.

It will be good to have a release date for the actual release.

Great, thanks for letting me know. Release date will be within a few days of jira 6.3 release, whenever that might be (I thought June), and initially it will only be marked compatible with 6.3.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Feb 07, 2019 in Marketplace Apps

A Timeless Love Story

It started as any story starts, on a normal, rainy day.   Admin meets App, and her name was Klok2, and like any first relationship we were both trying to make it work but neither one knew what...

439 views 8 26
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