Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,368,866
Community Members
 
Community Events
168
Community Groups

NullPointerExecption attempting to list all filters for authenticated users

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

Atlassian Community Events