You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Dirk Rudolph (JIRA)" <ji...@apache.org> on 2017/12/18 22:39:01 UTC

[jira] [Created] (OAK-7078) NullPointerException in FilteredSortedSetDocValuesFacetCounts during query evaluation

Dirk Rudolph created OAK-7078:
---------------------------------

             Summary: 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


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 
{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)