Apache Lucene open-source search software
SOLR-7151: SolrClient query methods throw IOException
Alan Woodwardd7eefdd7a7dd
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 6944005eba7..c1dde326d7e 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -71,6 +71,16 @@ Apache UIMA 2.3.1Apache ZooKeeper 3.4.6Jetty 9.2.6.v20141205+Upgrading from Solr 5.0+-----------------------++* SolrClient query functions now declare themselves as throwing IOException in+ addition to SolrServerException, to bring them in line with the update+ functions.++* SolrRequest.process() is now final. Subclasses should instead be parametrized+ by their corresponding SolrResponse type, and implement createResponse()+Detailed Change List----------------------@@ -216,6 +226,8 @@ Other Changes* SOLR-7130: Make stale state notification work without failing the requests(Noble Paul, shalin)+* SOLR-7151: SolrClient query methods throw IOException+================== 5.0.0 ==================Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SolrEntityProcessor.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SolrEntityProcessor.javaindex cabd7a0563c..7292c672dc7 100644--- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SolrEntityProcessor.java+++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SolrEntityProcessor.java@@ -196,7 +196,7 @@ public class SolrEntityProcessor extends EntityProcessorBase {QueryResponse response = null;try {response = solrClient.query(solrQuery);- } catch (SolrServerException e) {+ } catch (SolrServerException | IOException e) {if (ABORT.equals(onError)) {wrapAndThrow(SEVERE, e);} else if (SKIP.equals(onError)) {diff --git a/solr/contrib/map-reduce/src/test/org/apache/solr/hadoop/MorphlineGoLiveMiniMRTest.java b/solr/contrib/map-reduce/src/test/org/apache/solr/hadoop/MorphlineGoLiveMiniMRTest.javaindex 9a395f60200..f3da031ad10 100644--- a/solr/contrib/map-reduce/src/test/org/apache/solr/hadoop/MorphlineGoLiveMiniMRTest.java+++ b/solr/contrib/map-reduce/src/test/org/apache/solr/hadoop/MorphlineGoLiveMiniMRTest.java@@ -686,7 +686,7 @@ public class MorphlineGoLiveMiniMRTest extends AbstractFullDistribZkTestBase {}}- private SolrDocumentList executeSolrQuery(SolrClient collection, String queryString) throws SolrServerException {+ private SolrDocumentList executeSolrQuery(SolrClient collection, String queryString) throws SolrServerException, IOException {SolrQuery query = new SolrQuery(queryString).setRows(2 * RECORD_COUNT).addSort("id", ORDER.asc);QueryResponse response = collection.query(query);return response.getResults();diff --git a/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java b/solr/core/src/test/org/apache/solr/TestDistributedGrouping.javaindex 7b86bd8bdc3..37edb272378 100644--- a/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java+++ b/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java@@ -26,6 +26,8 @@ import org.apache.solr.common.params.ModifiableSolrParams;import org.apache.solr.common.util.NamedList;import org.junit.Test;+import java.io.IOException;+/*** TODO? perhaps use:* http://docs.codehaus.org/display/JETTY/ServletTester@@ -266,7 +268,7 @@ public class TestDistributedGrouping extends BaseDistributedSearchTestCase {simpleQuery("q", "*:*", "rows", 10, "fl", "id," + i1, "group", "true", "group.field", i1, "debug", "true");}- private void simpleQuery(Object... queryParams) throws SolrServerException {+ private void simpleQuery(Object... queryParams) throws SolrServerException, IOException {ModifiableSolrParams params = new ModifiableSolrParams();for (int i = 0; i < queryParams.length; i += 2) {params.add(queryParams[i].toString(), queryParams[i + 1].toString());diff --git a/solr/core/src/test/org/apache/solr/TestDistributedSearch.java b/solr/core/src/test/org/apache/solr/TestDistributedSearch.javaindex 76e98ca8f38..d27fbe46823 100644--- a/solr/core/src/test/org/apache/solr/TestDistributedSearch.java+++ b/solr/core/src/test/org/apache/solr/TestDistributedSearch.java@@ -17,11 +17,6 @@package org.apache.solr;-import java.util.ArrayList;-import java.util.Arrays;-import java.util.List;-import java.util.Map;-import org.apache.commons.lang.StringUtils;import org.apache.lucene.util.LuceneTestCase.Slow;import org.apache.solr.client.solrj.SolrClient;@@ -39,6 +34,12 @@ import org.apache.solr.common.params.ShardParams;import org.apache.solr.common.util.NamedList;import org.junit.Test;+import java.io.IOException;+import java.util.ArrayList;+import java.util.Arrays;+import java.util.List;+import java.util.Map;+/*** TODO? perhaps use:* http://docs.codehaus.org/display/JETTY/ServletTester@@ -633,7 +634,7 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {if (verifyStress) {comparePartialResponses(rsp, controlRsp, upShards);}- } catch (SolrServerException e) {+ } catch (SolrServerException | IOException e) {throw new RuntimeException(e);}}@@ -648,7 +649,7 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {}}- protected QueryResponse queryRandomUpServer(ModifiableSolrParams params, List<SolrClient> upClients) throws SolrServerException {+ protected QueryResponse queryRandomUpServer(ModifiableSolrParams params, List<SolrClient> upClients) throws SolrServerException, IOException {// query a random "up" serverint which = r.nextInt(upClients.size());SolrClient client = upClients.get(which);diff --git a/solr/core/src/test/org/apache/solr/TestTolerantSearch.java b/solr/core/src/test/org/apache/solr/TestTolerantSearch.javaindex 4e3581e2702..270e270d77b 100644--- a/solr/core/src/test/org/apache/solr/TestTolerantSearch.java+++ b/solr/core/src/test/org/apache/solr/TestTolerantSearch.java@@ -109,7 +109,7 @@ public class TestTolerantSearch extends SolrJettyTestBase {}@SuppressWarnings("unchecked")- public void testGetFieldsPhaseError() throws SolrServerException {+ public void testGetFieldsPhaseError() throws SolrServerException, IOException {BadResponseWriter.failOnGetFields = true;BadResponseWriter.failOnGetTopIds = false;SolrQuery query = new SolrQuery();@@ -157,7 +157,7 @@ public class TestTolerantSearch extends SolrJettyTestBase {}@SuppressWarnings("unchecked")- public void testGetTopIdsPhaseError() throws SolrServerException {+ public void testGetTopIdsPhaseError() throws SolrServerException, IOException {BadResponseWriter.failOnGetTopIds = true;BadResponseWriter.failOnGetFields = false;SolrQuery query = new SolrQuery();diff --git a/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.javaindex 2713351f265..efeece452ed 100644--- a/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java@@ -1127,7 +1127,7 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase {}@Override- protected QueryResponse queryServer(ModifiableSolrParams params) throws SolrServerException {+ protected QueryResponse queryServer(ModifiableSolrParams params) throws SolrServerException, IOException {if (r.nextBoolean())return super.queryServer(params);diff --git a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.javaindex db88c115eda..61cb633f245 100644--- a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java@@ -1144,7 +1144,7 @@ public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBa}@Override- protected QueryResponse queryServer(ModifiableSolrParams params) throws SolrServerException {+ protected QueryResponse queryServer(ModifiableSolrParams params) throws SolrServerException, IOException {if (r.nextBoolean())return super.queryServer(params);diff --git a/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.java b/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.javaindex fa3e2122d95..8f7cbf701cb 100644--- a/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.java@@ -42,6 +42,7 @@ import org.apache.solr.util.DefaultSolrThreadFactory;import org.junit.BeforeClass;import org.junit.Test;+import java.io.IOException;import java.util.ArrayList;import java.util.HashMap;import java.util.HashSet;@@ -447,7 +448,7 @@ public class CustomCollectionTest extends AbstractFullDistribZkTestBase {@Override- protected QueryResponse queryServer(ModifiableSolrParams params) throws SolrServerException {+ protected QueryResponse queryServer(ModifiableSolrParams params) throws SolrServerException, IOException {if (r.nextBoolean())return super.queryServer(params);diff --git a/solr/core/src/test/org/apache/solr/cloud/DistribDocExpirationUpdateProcessorTest.java b/solr/core/src/test/org/apache/solr/cloud/DistribDocExpirationUpdateProcessorTest.javaindex 7a1772fc15c..a50874ae474 100644--- a/solr/core/src/test/org/apache/solr/cloud/DistribDocExpirationUpdateProcessorTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/DistribDocExpirationUpdateProcessorTest.java@@ -168,8 +168,8 @@ public class DistribDocExpirationUpdateProcessorTest extends AbstractFullDistrib* Query is garunteed to be executed at least once.*/private void waitForNoResults(int maxTimeLimitSeconds,- SolrParams params)- throws SolrServerException, InterruptedException {+ SolrParams params)+ throws SolrServerException, InterruptedException, IOException {final long giveUpAfter = System.currentTimeMillis() + (1000L * maxTimeLimitSeconds);long numFound = cloudClient.query(params).getResults().getNumFound();diff --git a/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.java b/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.javaindex b142cfe1f72..279b4a70d08 100644--- a/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.java@@ -751,7 +751,7 @@ public class FullSolrCloudDistribCmdsTest extends AbstractFullDistribZkTestBaseassertEquals(1, res.getResults().getNumFound());}- private QueryResponse query(SolrClient client) throws SolrServerException {+ private QueryResponse query(SolrClient client) throws SolrServerException, IOException {SolrQuery query = new SolrQuery("*:*");return client.query(query);}diff --git a/solr/core/src/test/org/apache/solr/cloud/TestCloudPivotFacet.java b/solr/core/src/test/org/apache/solr/cloud/TestCloudPivotFacet.javaindex 8b14bfc8b54..ad689623952 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestCloudPivotFacet.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestCloudPivotFacet.java@@ -16,36 +16,42 @@*/package org.apache.solr.cloud;+import org.apache.commons.lang.StringUtils;import org.apache.lucene.util.TestUtil;import org.apache.solr.SolrTestCaseJ4.SuppressSSL;import org.apache.solr.client.solrj.SolrServerException;import org.apache.solr.client.solrj.response.FieldStatsInfo;-import org.apache.solr.client.solrj.response.QueryResponse;import org.apache.solr.client.solrj.response.PivotField;+import org.apache.solr.client.solrj.response.QueryResponse;import org.apache.solr.common.SolrInputDocument;+import org.apache.solr.common.params.FacetParams;+import org.apache.solr.common.params.ModifiableSolrParams;+import org.apache.solr.common.params.SolrParams;import org.apache.solr.common.params.StatsParams;import org.apache.solr.common.util.NamedList;-import org.apache.solr.common.params.SolrParams;-import org.apache.solr.common.params.ModifiableSolrParams;import org.apache.solr.schema.TrieDateField;--import org.apache.solr.common.params.FacetParams; // jdoc lint-import static org.apache.solr.common.params.FacetParams.*;--import org.apache.commons.lang.StringUtils;-import org.junit.BeforeClass;-import org.junit.Test;import org.slf4j.Logger;import org.slf4j.LoggerFactory;+import java.io.IOException;import java.util.Arrays;-import java.util.Set;+import java.util.Date;import java.util.HashSet;import java.util.List;import java.util.Map;-import java.util.Date;+import java.util.Set;++import static org.apache.solr.common.params.FacetParams.FACET;+import static org.apache.solr.common.params.FacetParams.FACET_LIMIT;+import static org.apache.solr.common.params.FacetParams.FACET_MISSING;+import static org.apache.solr.common.params.FacetParams.FACET_OFFSET;+import static org.apache.solr.common.params.FacetParams.FACET_OVERREQUEST_COUNT;+import static org.apache.solr.common.params.FacetParams.FACET_OVERREQUEST_RATIO;+import static org.apache.solr.common.params.FacetParams.FACET_PIVOT;+import static org.apache.solr.common.params.FacetParams.FACET_PIVOT_MINCOUNT;+import static org.apache.solr.common.params.FacetParams.FACET_SORT;/*** <p>@@ -319,8 +325,8 @@ public class TestCloudPivotFacet extends AbstractFullDistribZkTestBase {* @param constraint filters on pivot* @param params base solr parameters*/- private void assertPivotData(String pivotName, PivotField constraint, SolrParams params)- throws SolrServerException {+ private void assertPivotData(String pivotName, PivotField constraint, SolrParams params)+ throws SolrServerException, IOException {SolrParams p = SolrParams.wrapDefaults(params("rows","0"), params);QueryResponse res = cloudClient.query(p);diff --git a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.javaindex 45c33542c0f..228ddcb557e 100644--- a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java+++ b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java@@ -18,7 +18,6 @@ package org.apache.solr.handler;import org.apache.lucene.store.Directory;import org.apache.lucene.store.FSDirectory;-import org.apache.lucene.util.IOUtils;import org.apache.lucene.util.LuceneTestCase.Slow;import org.apache.lucene.util.TestUtil;import org.apache.solr.BaseDistributedSearchTestCase;@@ -172,7 +171,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {return s.add(doc).getStatus();}- NamedList query(String query, SolrClient s) throws SolrServerException {+ NamedList query(String query, SolrClient s) throws SolrServerException, IOException {NamedList res = new SimpleOrderedMap();ModifiableSolrParams params = new ModifiableSolrParams();diff --git a/solr/core/src/test/org/apache/solr/handler/admin/ShowFileRequestHandlerTest.java b/solr/core/src/test/org/apache/solr/handler/admin/ShowFileRequestHandlerTest.javaindex e882ba735f8..dd5ad3403de 100644--- a/solr/core/src/test/org/apache/solr/handler/admin/ShowFileRequestHandlerTest.java+++ b/solr/core/src/test/org/apache/solr/handler/admin/ShowFileRequestHandlerTest.java@@ -45,7 +45,7 @@ public class ShowFileRequestHandlerTest extends SolrJettyTestBase {createJetty(legacyExampleCollection1SolrHome(), null, null);}- public void test404ViaHttp() throws SolrServerException {+ public void test404ViaHttp() throws SolrServerException, IOException {SolrClient client = getSolrClient();QueryRequest request = new QueryRequest(params("file","does-not-exist-404.txt"));@@ -80,7 +80,7 @@ public class ShowFileRequestHandlerTest extends SolrJettyTestBase {}}- public void testDirList() throws SolrServerException {+ public void testDirList() throws SolrServerException, IOException {SolrClient client = getSolrClient();//assertQ(req("qt", "/admin/file")); TODO file bug that SolrJettyTestBase extends SolrTestCaseJ4QueryRequest request = new QueryRequest();diff --git a/solr/core/src/test/org/apache/solr/handler/component/DistributedDebugComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/DistributedDebugComponentTest.javaindex ef9be3d9a62..a64555c69f2 100644--- a/solr/core/src/test/org/apache/solr/handler/component/DistributedDebugComponentTest.java+++ b/solr/core/src/test/org/apache/solr/handler/component/DistributedDebugComponentTest.java@@ -18,6 +18,7 @@ import org.junit.BeforeClass;import org.junit.Test;import java.io.File;+import java.io.IOException;import java.util.ArrayList;import java.util.Arrays;import java.util.HashSet;@@ -263,7 +264,7 @@ public class DistributedDebugComponentTest extends SolrJettyTestBase {}- private void verifyDebugSections(SolrQuery query, SolrClient client) throws SolrServerException {+ private void verifyDebugSections(SolrQuery query, SolrClient client) throws SolrServerException, IOException {query.set("debugQuery", "true");query.remove("debug");QueryResponse response = client.query(query);@@ -343,7 +344,7 @@ public class DistributedDebugComponentTest extends SolrJettyTestBase {assertNull(response.getDebugMap());}- public void testCompareWithNonDistributedRequest() throws SolrServerException {+ public void testCompareWithNonDistributedRequest() throws SolrServerException, IOException {SolrQuery query = new SolrQuery();query.setQuery("id:1");query.setFilterQueries("id:[0 TO 10]");@@ -375,7 +376,7 @@ public class DistributedDebugComponentTest extends SolrJettyTestBase {assertSameKeys((NamedList<?>)nonDistribResponse.getDebugMap().get("timing"), (NamedList<?>)distribResponse.getDebugMap().get("timing"));}- public void testTolerantSearch() throws SolrServerException {+ public void testTolerantSearch() throws SolrServerException, IOException {String badShard = "[ff01::0083]:3334";SolrQuery query = new SolrQuery();query.setQuery("*:*");diff --git a/solr/core/src/test/org/apache/solr/handler/component/DistributedQueryComponentOptimizationTest.java b/solr/core/src/test/org/apache/solr/handler/component/DistributedQueryComponentOptimizationTest.javaindex 57733e38aa1..d13b82ba2f9 100644--- a/solr/core/src/test/org/apache/solr/handler/component/DistributedQueryComponentOptimizationTest.java+++ b/solr/core/src/test/org/apache/solr/handler/component/DistributedQueryComponentOptimizationTest.java@@ -17,12 +17,6 @@ package org.apache.solr.handler.component;* limitations under the License.*/-import java.nio.ByteBuffer;-import java.util.HashSet;-import java.util.List;-import java.util.Map;-import java.util.Set;-import org.apache.solr.client.solrj.response.QueryResponse;import org.apache.solr.cloud.AbstractFullDistribZkTestBase;import org.apache.solr.common.params.CommonParams;@@ -31,6 +25,12 @@ import org.apache.solr.common.util.SimpleOrderedMap;import org.apache.solr.common.util.StrUtils;import org.junit.Test;+import java.nio.ByteBuffer;+import java.util.HashSet;+import java.util.List;+import java.util.Map;+import java.util.Set;+/*** Test for QueryComponent's distributed querying optimization.* If the "fl" param is just "id" or just "id,score", all document data to return is already fetched by STAGE_EXECUTE_QUERY.diff --git a/solr/core/src/test/org/apache/solr/request/TestRemoteStreaming.java b/solr/core/src/test/org/apache/solr/request/TestRemoteStreaming.javaindex a276afc2595..6a9cb43da5d 100644--- a/solr/core/src/test/org/apache/solr/request/TestRemoteStreaming.java+++ b/solr/core/src/test/org/apache/solr/request/TestRemoteStreaming.java@@ -125,7 +125,7 @@ public class TestRemoteStreaming extends SolrJettyTestBase {/** SOLR-3161* Technically stream.body isn't remote streaming, but there wasn't a better place for this test method. */@Test(expected = SolrException.class)- public void testQtUpdateFails() throws SolrServerException {+ public void testQtUpdateFails() throws SolrServerException, IOException {SolrQuery query = new SolrQuery();query.setQuery( "*:*" );//for anythingquery.add("echoHandler","true");@@ -152,7 +152,7 @@ public class TestRemoteStreaming extends SolrJettyTestBase {return client.getBaseURL()+"/update?commit=true&stream.body="+ URLEncoder.encode(deleteQuery, "UTF-8");}- private boolean searchFindsIt() throws SolrServerException {+ private boolean searchFindsIt() throws SolrServerException, IOException {SolrQuery query = new SolrQuery();query.setQuery( "id:1234" );QueryResponse rsp = getSolrClient().query(query);diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/SolrClient.javaindex 2c88970db15..d9d9966156e 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/SolrClient.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/SolrClient.java@@ -305,7 +305,7 @@ public abstract class SolrClient implements Serializable, Closeable {* Performs a query to the Solr server* @param params an object holding all key/value parameters to send along the request*/- public QueryResponse query(SolrParams params) throws SolrServerException {+ public QueryResponse query(SolrParams params) throws SolrServerException, IOException {return new QueryRequest(params).process(this);}@@ -314,7 +314,7 @@ public abstract class SolrClient implements Serializable, Closeable {* @param params an object holding all key/value parameters to send along the request* @param method specifies the HTTP method to use for the request, such as GET or POST*/- public QueryResponse query(SolrParams params, METHOD method) throws SolrServerException {+ public QueryResponse query(SolrParams params, METHOD method) throws SolrServerException, IOException {return new QueryRequest(params, method).process(this);}@@ -343,7 +343,7 @@ public abstract class SolrClient implements Serializable, Closeable {** @return retrieved SolrDocument, null if no document is found.*/- public SolrDocument getById(String id) throws SolrServerException {+ public SolrDocument getById(String id) throws SolrServerException, IOException {return getById(id, null);}@@ -353,7 +353,7 @@ public abstract class SolrClient implements Serializable, Closeable {** @return retrieved SolrDocument, null if no document is found.*/- public SolrDocument getById(String id, SolrParams params) throws SolrServerException {+ public SolrDocument getById(String id, SolrParams params) throws SolrServerException, IOException {SolrDocumentList docs = getById(Arrays.asList(id), params);if (!docs.isEmpty()) {return docs.get(0);@@ -365,7 +365,7 @@ public abstract class SolrClient implements Serializable, Closeable {* Retrieves the SolrDocuments associated with the given identifiers.* If a document was not found, it will not be added to the SolrDocumentList.*/- public SolrDocumentList getById(Collection<String> ids) throws SolrServerException {+ public SolrDocumentList getById(Collection<String> ids) throws SolrServerException, IOException {return getById(ids, null);}@@ -374,7 +374,7 @@ public abstract class SolrClient implements Serializable, Closeable {* the SolrParams to execute the request.* If a document was not found, it will not be added to the SolrDocumentList.*/- public SolrDocumentList getById(Collection<String> ids, SolrParams params) throws SolrServerException {+ public SolrDocumentList getById(Collection<String> ids, SolrParams params) throws SolrServerException, IOException {if (ids == null || ids.isEmpty()) {throw new IllegalArgumentException("Must provide an identifier of a document to retrieve.");}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java b/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.javaindex e5d829466f3..6d4efb625cd 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java@@ -125,7 +125,7 @@ public abstract class SolrRequest<T extends SolrResponse> implements Serializabl* @throws SolrServerException if there is an error on the Solr server* @throws IOException if there is a communication error*/- public T process(SolrClient client) throws SolrServerException, IOException {+ public final T process(SolrClient client) throws SolrServerException, IOException {long startTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);T res = createResponse(client);res.setResponse(client.request(this));diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/QueryRequest.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/QueryRequest.javaindex 3ba5a869006..9d47f992053 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/QueryRequest.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/QueryRequest.java@@ -19,15 +19,12 @@ package org.apache.solr.client.solrj.request;import org.apache.solr.client.solrj.SolrClient;import org.apache.solr.client.solrj.SolrRequest;-import org.apache.solr.client.solrj.SolrServerException;import org.apache.solr.client.solrj.response.QueryResponse;import org.apache.solr.common.params.CommonParams;import org.apache.solr.common.params.SolrParams;import org.apache.solr.common.util.ContentStream;-import java.io.IOException;import java.util.Collection;-import java.util.concurrent.TimeUnit;/***@@ -83,26 +80,6 @@ public class QueryRequest extends SolrRequest<QueryResponse> {return new QueryResponse(client);}- /**- * Send this request to a {@link SolrClient} and return the response- * @param client the SolrClient to communicate with- * @return the response- * @throws org.apache.solr.client.solrj.SolrServerException if there is an error on the Solr server- */- @Override- public QueryResponse process(SolrClient client) throws SolrServerException {- long startTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);- QueryResponse res = createResponse(client);- try {- res.setResponse(client.request(this));- } catch (IOException e) {- throw new SolrServerException("Error executing query", e);- }- long endTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);- res.setElapsedTime(endTime - startTime);- return res;- }-@Overridepublic SolrParams getParams() {return query;diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/LargeVolumeTestBase.java b/solr/solrj/src/test/org/apache/solr/client/solrj/LargeVolumeTestBase.javaindex d231a94f12d..d2a37b87a9e 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/LargeVolumeTestBase.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/LargeVolumeTestBase.java@@ -26,6 +26,7 @@ import org.junit.Test;import org.slf4j.Logger;import org.slf4j.LoggerFactory;+import java.io.IOException;import java.util.ArrayList;import java.util.List;@@ -65,7 +66,7 @@ public abstract class LargeVolumeTestBase extends SolrJettyTestBaselog.info("done");}- private void query(int count) throws SolrServerException {+ private void query(int count) throws SolrServerException, IOException {SolrClient client = this.getSolrClient();SolrQuery query = new SolrQuery("*:*");QueryResponse response = client.query(query);diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.javaindex c0b30dcf084..5410c1fa2fd 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java@@ -1441,7 +1441,7 @@ abstract public class SolrExampleTests extends SolrExampleTestsBase}@Test- public void testQueryWithParams() throws SolrServerException {+ public void testQueryWithParams() throws SolrServerException, IOException {SolrClient client = getSolrClient();SolrQuery q = new SolrQuery("query");q.setParam("debug", true);diff --git a/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java b/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.javaindex eb21a609b7f..3fdf0777f6a 100644--- a/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java+++ b/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java@@ -536,7 +536,7 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {}}- protected QueryResponse queryServer(ModifiableSolrParams params) throws SolrServerException {+ protected QueryResponse queryServer(ModifiableSolrParams params) throws SolrServerException, IOException {// query a random serverint which = r.nextInt(clients.size());SolrClient client = clients.get(which);@@ -607,7 +607,7 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {if (verifyStress) {compareResponses(rsp, controlRsp);}- } catch (SolrServerException e) {+ } catch (SolrServerException | IOException e) {throw new RuntimeException(e);}}@@ -623,10 +623,10 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {return rsp;}- public QueryResponse queryAndCompare(SolrParams params, SolrClient... clients) throws SolrServerException {+ public QueryResponse queryAndCompare(SolrParams params, SolrClient... clients) throws SolrServerException, IOException {return queryAndCompare(params, Arrays.<SolrClient>asList(clients));}- public QueryResponse queryAndCompare(SolrParams params, Iterable<SolrClient> clients) throws SolrServerException {+ public QueryResponse queryAndCompare(SolrParams params, Iterable<SolrClient> clients) throws SolrServerException, IOException {QueryResponse first = null;for (SolrClient client : clients) {QueryResponse rsp = client.query(new ModifiableSolrParams(params));diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.javaindex bd0bbf4ca5b..14aaf79ae33 100644--- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java+++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java@@ -1191,11 +1191,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTeslong num = cjetty.client.solrClient.query(query).getResults().getNumFound();System.err.println("DOCS:" + num);- } catch (SolrServerException e) {- System.err.println("error contacting client: " + e.getMessage()- + "\n");- continue;- } catch (SolrException e) {+ } catch (SolrServerException | SolrException | IOException e) {System.err.println("error contacting client: " + e.getMessage()+ "\n");continue;@@ -1401,7 +1397,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes@Overrideprotected QueryResponse queryServer(ModifiableSolrParams params)- throws SolrServerException {+ throws SolrServerException, IOException {if (r.nextBoolean()) params.set("collection", DEFAULT_COLLECTION);diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/CloudInspectUtil.java b/solr/test-framework/src/java/org/apache/solr/cloud/CloudInspectUtil.javaindex f710b55e997..7f91cd7f70d 100644--- a/solr/test-framework/src/java/org/apache/solr/cloud/CloudInspectUtil.java+++ b/solr/test-framework/src/java/org/apache/solr/cloud/CloudInspectUtil.java@@ -9,6 +9,7 @@ import org.apache.solr.common.params.SolrParams;import org.slf4j.Logger;import org.slf4j.LoggerFactory;+import java.io.IOException;import java.util.HashMap;import java.util.HashSet;import java.util.Map;@@ -161,7 +162,7 @@ public class CloudInspectUtil {* @return true if the compared results are illegal.*/public static boolean compareResults(SolrClient controlClient, SolrClient cloudClient)- throws SolrServerException {+ throws SolrServerException, IOException {return compareResults(controlClient, cloudClient, null, null);}@@ -171,7 +172,7 @@ public class CloudInspectUtil {* @return true if the compared results are illegal.*/public static boolean compareResults(SolrClient controlClient, SolrClient cloudClient, Set<String> addFails, Set<String> deleteFails)- throws SolrServerException {+ throws SolrServerException, IOException {SolrParams q = SolrTestCaseJ4.params("q","*:*","rows","0", "tests","checkShardConsistency(vsControl)"); // add a tag to aid in debugging via logs