Skip to content

Apache Lucene open-source search software

SOLR-6173: Fixed wrong failure message in TestDistributedSearch

Shalin Shekhar Mangarc0d5fbb8293e
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 42939e7c7b1..e889317896c 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -88,10 +88,16 @@ Other Changes
================== 4.10.0 =================
-Bug fixes
+Bug Fixes
+----------------------
* SOLR-6095 : SolrCloud cluster can end up without an overseer with overseer roles (Noble Paul, Shalin Mangar)
+Other Changes
+---------------------
+
+* SOLR-6173: Fixed wrong failure message in TestDistributedSearch. (shalin)
+
================== 4.9.0 ==================
Versions of Major Components
diff --git a/solr/core/src/test/org/apache/solr/TestDistributedSearch.java b/solr/core/src/test/org/apache/solr/TestDistributedSearch.java
index 56aafb3b8ea..0ab57f5417d 100644
--- a/solr/core/src/test/org/apache/solr/TestDistributedSearch.java
+++ b/solr/core/src/test/org/apache/solr/TestDistributedSearch.java
@@ -27,6 +27,7 @@ import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
+import org.apache.solr.client.solrj.impl.HttpSolrServer;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.cloud.ChaosMonkey;
import org.apache.solr.common.SolrException;
@@ -269,10 +270,10 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {
query("q","*:*", "sort",i1+" desc", "stats", "true", "stats.field", tdate_b);
handle.put("stats_fields", UNORDERED);
- query("q","*:*", "sort",i1+" desc", "stats", "true",
- "stats.field", "stats_dt",
- "stats.field", i1,
- "stats.field", tdate_a,
+ query("q","*:*", "sort",i1+" desc", "stats", "true",
+ "stats.field", "stats_dt",
+ "stats.field", i1,
+ "stats.field", tdate_a,
"stats.field", tdate_b);
/*** TODO: the failure may come back in "exception"
@@ -430,9 +431,12 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {
"stats.field", tdate_a,
"stats.field", tdate_b,
"stats.calcdistinct", "true");
- } catch (Exception e) {
- log.error("Exception on distrib stats request on empty index", e);
- fail("NullPointerException with stats request on empty index");
+ } catch (HttpSolrServer.RemoteSolrException e) {
+ if (e.getMessage().startsWith("java.lang.NullPointerException")) {
+ fail("NullPointerException with stats request on empty index");
+ } else {
+ throw e;
+ }
}
}