lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raju444us <gudipal...@gmail.com>
Subject Facet query throws NullPointerException when the facetqueries response is null in QueryResponse object
Date Thu, 17 Sep 2009 19:49:19 GMT


The extractFacetInfo(...)  method of QueryResponse object throws
NullPointerExcpetion when the facetQueries are null.

The code in bold  will throw NullPointerException if the fq param is null.

    // Parse the queries
    _facetQuery = new HashMap<String, Integer>();
    NamedList<Integer> fq = (NamedList<Integer>) info.get( "facet_queries"
);
    for( Map.Entry<String, Integer> entry : fq ) {
      _facetQuery.put( entry.getKey(), entry.getValue() );
    }

the patch for this is

    // Parse the queries
    _facetQuery = new HashMap<String, Integer>();
    NamedList<Integer> fq = (NamedList<Integer>) info.get( "facet_queries"
);
if(fq!= null)
{
for( Map.Entry<String, Integer> entry : fq ) {
      _facetQuery.put( entry.getKey(), entry.getValue() );
    }
}
-- 
View this message in context: http://www.nabble.com/Facet-query-throws-NullPointerException-when-the-facetqueries-response-is-null-in-QueryResponse-object-tp25492240p25492240.html
Sent from the Solr - Dev mailing list archive at Nabble.com.


Mime
View raw message