[ https://issues.apache.org/jira/browse/OAK-7078?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vikas Saurabh resolved OAK-7078. -------------------------------- Resolution: Fixed Fix Version/s: 1.8 1.6.8 1.4.19 Thanks [~diru] for the patch. Have applied your fix and slightly modified test on trunk at [r1819048|https://svn.apache.org/r1819048], [r1819050|https://svn.apache.org/r1819050], on 1.6 branch at [r1819056|https://svn.apache.org/r1819056], and on 1.4 branch at [r1819060|https://svn.apache.org/r1819060]. > NullPointerException in FilteredSortedSetDocValuesFacetCounts during query > evaluation > ------------------------------------------------------------------------------------- > > Key: OAK-7078 > URL: https://issues.apache.org/jira/browse/OAK-7078 > Project: Jackrabbit Oak > Issue Type: Bug > Components: lucene > Affects Versions: 1.6.7 > Reporter: Dirk Rudolph > Assignee: Vikas Saurabh > Labels: facet > Fix For: 1.4.19, 1.6.8, 1.8 > > > Running the following query {{select \[rep:facet(simple/tags)] from > \[nt:base] where contains(\[text], 'ipsum')}} with the following content > {code} > /content/foo > - text = "lorem lorem" > + simple/ > - tags = ["tag1", "tag2"] > /content/bar > - text = "lorem ipsum" > {code} > runs in the following NPE > {code} > java.lang.NullPointerException > at > org.apache.jackrabbit.oak.plugins.index.lucene.util.FilteredSortedSetDocValuesFacetCounts.getTopChildren(FilteredSortedSetDocValuesFacetCounts.java:63) > at > org.apache.lucene.facet.MultiFacets.getTopChildren(MultiFacets.java:52) > at > org.apache.jackrabbit.oak.plugins.index.lucene.LucenePropertyIndex$LucenePathCursor$2.getValue(LucenePropertyIndex.java:1646) > ... 38 more > {code} > This is because the result set for the query only contains {{/content/bar}} > and with that the count of the dimension {{simple/tag}} is 0. For that case > [SortedSetDocValuesFacetCounts#getDim()|https://github.com/apache/lucene-solr/blob/releases/lucene-solr/4.7.1/lucene/facet/src/java/org/apache/lucene/facet/sortedset/SortedSetDocValuesFacetCounts.java#L108] > returns {{null}} and so does {{getTopChildren}}. > This expected behaviour is properly handled in > [LucenePropertyIndex.java#L1647|https://github.com/apache/jackrabbit-oak/blob/jackrabbit-oak-1.6.7/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java#L1647] > but not in > [FilteredSortedSetDocValuesFacetCounts.java#L63|https://github.com/apache/jackrabbit-oak/blob/jackrabbit-oak-1.6.7/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/util/FilteredSortedSetDocValuesFacetCounts.java#L63] > where {{topChildren}} is dereferenced without null check. > To workaround that secure facets can be set to false, though the default > value is true. > -- This message was sent by Atlassian JIRA (v6.4.14#64029)