You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ro...@apache.org on 2013/12/13 20:47:06 UTC
svn commit: r1550824 - in /lucene/dev/trunk/solr: ./
contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/
core/src/java/org/apache/solr/handler/component/
solrj/src/java/org/apache/solr/client/solrj/impl/
Author: romseygeek
Date: Fri Dec 13 19:47:06 2013
New Revision: 1550824
URL: http://svn.apache.org/r1550824
Log:
SOLR-5555: CloudSolrServer and LBHttpSolrServer shouldn't throw MUE from constructors
Modified:
lucene/dev/trunk/solr/CHANGES.txt
lucene/dev/trunk/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/SolrLocator.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java
lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java
Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1550824&r1=1550823&r2=1550824&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Fri Dec 13 19:47:06 2013
@@ -73,7 +73,9 @@ Apache ZooKeeper 3.4.5
Upgrading from Solr 4.6.0
----------------------
-
+
+* CloudSolrServer and LBHttpSolrServer no longer declare MalfurmedURLException
+ as thrown from their constructors.
Detailed Change List
----------------------
@@ -248,6 +250,9 @@ Other Changes
* SOLR-5548: Give DistributedSearchTestCase / JettySolrRunner the ability to
specify extra filters. (Greg Chanan via Mark Miller)
+* SOLR-5555: LBHttpSolrServer and CloudSolrServer constructors don't need to
+ declare MalformedURLExceptions (Sushil Bajracharya, Alan Woodward)
+
================== 4.6.0 ==================
Versions of Major Components
Modified: lucene/dev/trunk/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/SolrLocator.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/SolrLocator.java?rev=1550824&r1=1550823&r2=1550824&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/SolrLocator.java (original)
+++ lucene/dev/trunk/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/SolrLocator.java Fri Dec 13 19:47:06 2013
@@ -16,12 +16,15 @@
*/
package org.apache.solr.morphlines.solr;
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-
-import javax.xml.parsers.ParserConfigurationException;
-
+import com.cloudera.cdk.morphline.api.MorphlineCompilationException;
+import com.cloudera.cdk.morphline.api.MorphlineContext;
+import com.cloudera.cdk.morphline.api.MorphlineRuntimeException;
+import com.cloudera.cdk.morphline.base.Configs;
+import com.google.common.base.Preconditions;
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
+import com.typesafe.config.ConfigRenderOptions;
+import com.typesafe.config.ConfigUtil;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.impl.CloudSolrServer;
import org.apache.solr.common.cloud.SolrZkClient;
@@ -35,15 +38,9 @@ import org.slf4j.LoggerFactory;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
-import com.cloudera.cdk.morphline.api.MorphlineCompilationException;
-import com.cloudera.cdk.morphline.api.MorphlineContext;
-import com.cloudera.cdk.morphline.api.MorphlineRuntimeException;
-import com.cloudera.cdk.morphline.base.Configs;
-import com.google.common.base.Preconditions;
-import com.typesafe.config.Config;
-import com.typesafe.config.ConfigFactory;
-import com.typesafe.config.ConfigRenderOptions;
-import com.typesafe.config.ConfigUtil;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.File;
+import java.io.IOException;
/**
* Set of configuration parameters that identify the location and schema of a Solr server or
@@ -94,14 +91,10 @@ public class SolrLocator {
if (collectionName == null || collectionName.length() == 0) {
throw new MorphlineCompilationException("Parameter 'zkHost' requires that you also pass parameter 'collection'", config);
}
- try {
- CloudSolrServer cloudSolrServer = new CloudSolrServer(zkHost);
- cloudSolrServer.setDefaultCollection(collectionName);
- cloudSolrServer.connect();
- return new SolrServerDocumentLoader(cloudSolrServer, batchSize);
- } catch (MalformedURLException e) {
- throw new MorphlineRuntimeException(e);
- }
+ CloudSolrServer cloudSolrServer = new CloudSolrServer(zkHost);
+ cloudSolrServer.setDefaultCollection(collectionName);
+ cloudSolrServer.connect();
+ return new SolrServerDocumentLoader(cloudSolrServer, batchSize);
} else {
if (solrUrl == null || solrUrl.length() == 0) {
throw new MorphlineCompilationException("Missing parameter 'solrUrl'", config);
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java?rev=1550824&r1=1550823&r2=1550824&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java Fri Dec 13 19:47:06 2013
@@ -16,19 +16,6 @@ package org.apache.solr.handler.componen
* limitations under the License.
*/
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Collections;
-import java.util.List;
-import java.util.Random;
-import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.CompletionService;
-import java.util.concurrent.ExecutorCompletionService;
-import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
import org.apache.http.client.HttpClient;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpClientUtil;
@@ -44,6 +31,18 @@ import org.apache.solr.util.DefaultSolrT
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.CompletionService;
+import java.util.concurrent.ExecutorCompletionService;
+import java.util.concurrent.SynchronousQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
public class HttpShardHandlerFactory extends ShardHandlerFactory implements org.apache.solr.util.plugin.PluginInfoInitialized {
protected static Logger log = LoggerFactory.getLogger(HttpShardHandlerFactory.class);
@@ -158,12 +157,7 @@ public class HttpShardHandlerFactory ext
}
protected LBHttpSolrServer createLoadbalancer(HttpClient httpClient){
- try {
- return new LBHttpSolrServer(httpClient);
- } catch (MalformedURLException e) {
- // should be impossible since we're not passing any URLs here
- throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
- }
+ return new LBHttpSolrServer(httpClient);
}
protected <T> T getParameter(NamedList initArgs, String configKey, T defaultValue) {
Modified: lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java?rev=1550824&r1=1550823&r2=1550824&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java (original)
+++ lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java Fri Dec 13 19:47:06 2013
@@ -119,7 +119,7 @@ public class CloudSolrServer extends Sol
* @param zkHost The client endpoint of the zookeeper quorum containing the cloud state,
* in the form HOST:PORT.
*/
- public CloudSolrServer(String zkHost) throws MalformedURLException {
+ public CloudSolrServer(String zkHost) {
this.zkHost = zkHost;
this.myClient = HttpClientUtil.createClient(null);
this.lbServer = new LBHttpSolrServer(myClient);
Modified: lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java?rev=1550824&r1=1550823&r2=1550824&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java (original)
+++ lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java Fri Dec 13 19:47:06 2013
@@ -192,14 +192,12 @@ public class LBHttpSolrServer extends So
}
/** The provided httpClient should use a multi-threaded connection manager */
- public LBHttpSolrServer(HttpClient httpClient, String... solrServerUrl)
- throws MalformedURLException {
+ public LBHttpSolrServer(HttpClient httpClient, String... solrServerUrl) {
this(httpClient, new BinaryResponseParser(), solrServerUrl);
}
/** The provided httpClient should use a multi-threaded connection manager */
- public LBHttpSolrServer(HttpClient httpClient, ResponseParser parser, String... solrServerUrl)
- throws MalformedURLException {
+ public LBHttpSolrServer(HttpClient httpClient, ResponseParser parser, String... solrServerUrl) {
clientIsInternal = (httpClient == null);
this.parser = parser;
if (httpClient == null) {
@@ -234,7 +232,7 @@ public class LBHttpSolrServer extends So
return server;
}
- protected HttpSolrServer makeServer(String server) throws MalformedURLException {
+ protected HttpSolrServer makeServer(String server) {
HttpSolrServer s = new HttpSolrServer(server, httpClient, parser);
if (requestWriter != null) {
s.setRequestWriter(requestWriter);