Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-13180

ClassCastExceptions in o.a.s.s.facet.FacetModule for valid JSON inputs that are not objects

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 7.5, 9.0
    • 8.3
    • JSON Request API

    Description

      Requesting the following URL gives a 500 error due to a ClassCastException in o.a.s.s.f.FacetModule: http://localhost:8983/solr/films/select?json=0

      The error response is caught by an uncaught ClassCastException, with the stacktrace shown here:

      java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Map
      at org.apache.solr.search.facet.FacetModule.prepare(FacetModule.java:78)
      at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:272)

       

      The cause of this bug is similar to #13178: line 78 in FacetModule reads

      jsonFacet = (Map<String, Object>) json.get("facet")

      and assumes that the JSON object contained in facet is a JSON object, while we only guarantee that it is a JSON value.

      Line 92 semms to contain another situation like this, but I do not have a test case handy for this specific case.

      This bug was found using Diffblue Microservices Testing. Find more information on this test campaign.

      Attachments

        1. home.zip
          376 kB
          Johannes Kloos
        2. SOLR-13180.patch
          1 kB
          Jan Høydahl
        3. SOLR-13180.patch
          3 kB
          Munendra S N

        Issue Links

          Activity

            People

              munendrasn Munendra S N
              jkloos Johannes Kloos
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h