From 5e21e3f380bead8fc21c493ca134f73d4514d76f Mon Sep 17 00:00:00 2001 From: Bruno Roustant Date: Thu, 24 Dec 2020 11:43:04 +0100 Subject: [PATCH] SOLR-15061: Fix NPE in SearchHandler when shards.info and no QueryComponent configured --- solr/CHANGES.txt | 2 ++ .../java/org/apache/solr/handler/component/SearchHandler.java | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 5426eb8badd..a7ccf36f450 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -281,6 +281,8 @@ Bug Fixes * SOLR-15031: Fix preventing null being wrapped in a QueryValueSource subQuery. Such null queries can be caused by query text resulting in an empty token stream. (Pieter van Boxtel via Mike Drob) +* SOLR-15061: Fix NPE in SearchHandler when shards.info and no QueryComponent configured. (Bruno Roustant) + Other Changes --------------------- diff --git a/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java b/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java index 39e97956e4f..f5c2474c4a8 100644 --- a/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java @@ -521,8 +521,7 @@ public class SearchHandler extends RequestHandlerBase implements SolrCoreAware, StringWriter trace = new StringWriter(); cause.printStackTrace(new PrintWriter(trace)); nl.add("trace", trace.toString() ); - } - else { + } else if (rb.getResults() != null) { nl.add("numFound", rb.getResults().docList.matches()); nl.add("numFoundExact", rb.getResults().docList.hitCountRelation() == TotalHits.Relation.EQUAL_TO); nl.add("maxScore", rb.getResults().docList.maxScore());