Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

NullPointerExecption attempting to list all filters for authenticated users

Jeff Ward April 2, 2018

I'm trying to find all filters that are only assigned to authenticated users using the Adaptavist ScriptRunner plugin. Code is:

def userManager = ComponentManager.getComponentsOfType(JiraAuthenticationContext)?.first()
def currentUser = userManager.getLoggedInUser()

def searchManager = ComponentManager.getComponentsOfType(SearchRequestManager)?.first()

def searchParameter = new SharedEntitySearchParametersBuilder()
.setSharePermission(new SharePermissionImpl( SharedType.Name.AUTHENTICATED, "", ""))
.toSearchParameters()

def filters = searchManager.search(searchParameter, currentUser, 0, 50);
log.info("Found ${filters.totalResultCount} filters - fixing")
filters.foreach() {
log.info("Found: " + it.name);
}

 I'm getting the following NullPointerException:

java.lang.NullPointerException 
at org.apache.lucene.index.TermInfosReader$CloneableTerm.<init>(TermInfosReader.java:61)
at org.apache.lucene.index.TermInfosReader.get(TermInfosReader.java:218)
at org.apache.lucene.index.TermInfosReader.get(TermInfosReader.java:209)
at org.apache.lucene.index.SegmentReader.docFreq(SegmentReader.java:503)
at org.apache.lucene.search.TermQuery$TermWeight$1.add(TermQuery.java:56)
at org.apache.lucene.util.ReaderUtil$Gather.run(ReaderUtil.java:77)
at org.apache.lucene.util.ReaderUtil$Gather.run(ReaderUtil.java:82)
at org.apache.lucene.util.ReaderUtil$Gather.run(ReaderUtil.java:66)
at org.apache.lucene.search.TermQuery$TermWeight.<init>(TermQuery.java:62)
at org.apache.lucene.search.TermQuery.createWeight(TermQuery.java:198)
at org.apache.lucene.search.BooleanQuery$BooleanWeight.<init>(BooleanQuery.java:176)
at org.apache.lucene.search.BooleanQuery.createWeight(BooleanQuery.java:354)
at org.apache.lucene.search.Searcher.createNormalizedWeight(Searcher.java:168)
at org.apache.lucene.search.IndexSearcher.createNormalizedWeight(IndexSearcher.java:661)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:370)
at com.atlassian.jira.index.DelegateSearcher.search(DelegateSearcher.java:137)
at com.atlassian.jira.sharing.index.DefaultSharedEntitySearcher$1.getHits(DefaultSharedEntitySearcher.java:97)
at com.atlassian.jira.sharing.index.DefaultSharedEntitySearcher$Engine.search(DefaultSharedEntitySearcher.java:183)
at com.atlassian.jira.sharing.index.DefaultSharedEntitySearcher.search(DefaultSharedEntitySearcher.java:104)
at com.atlassian.jira.issue.search.DefaultSearchRequestManager.search(DefaultSearchRequestManager.java:306)
at com.atlassian.jira.issue.search.SearchRequestManager$search.call(Unknown Source)
at Script67.fixFilterPermissions(Script67.groovy:35) at Script67.run(Script67.groovy:80)


 JIRA 7.5.0

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events