Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-7078

NullPointerException in FilteredSortedSetDocValuesFacetCounts during query evaluation

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.7
    • Fix Version/s: 1.4.19, 1.6.8, 1.8.0
    • Component/s: lucene
    • Labels:

      Description

      Running the following query select [rep:facet(simple/tags)] from [nt:base] where contains([text], 'ipsum') with the following content

      /content/foo
       - text = "lorem lorem"
       + simple/
         - tags = ["tag1", "tag2"]
      /content/bar
       - text = "lorem ipsum"
      

      runs in the following NPE

      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
      

      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() returns null and so does getTopChildren.

      This expected behaviour is properly handled in LucenePropertyIndex.java#L1647 but not in 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.

        Attachments

          Activity

            People

            • Assignee:
              catholicon Vikas Saurabh
              Reporter:
              diru Dirk Rudolph
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: