Skip to content

Apache Lucene open-source search software

SOLR-5874: Unsafe cast in CloudSolrServer's RouteException. Change RouteException to handle Throwable rather than Exception. SOLR-5899: CloudSolrServer's RouteResponse and RouteException should be publicly accessible.

Mark Robert Miller76ab559958a9
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index dc6f571756f..46b6c619ced 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -194,6 +194,12 @@ Bug Fixes
* SOLR-5893: On restarting overseer designate , move itself to front of the queue (Noble Paul)
+* SOLR-5874: Unsafe cast in CloudSolrServer's RouteException. Change
+ RouteException to handle Throwable rather than Exception.
+ (Mark Miller, David Arthur)
+
+* SOLR-5899: CloudSolrServer's RouteResponse and RouteException should be
+ publicly accessible. (Mark Miller, shalin)
Optimizations
----------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
index 1f42d2c1e69..4fd66a79bb2 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
@@ -311,8 +311,8 @@ public class CloudSolrServer extends SolrServer {
return null;
}
- NamedList exceptions = new NamedList();
- NamedList shardResponses = new NamedList();
+ NamedList<Throwable> exceptions = new NamedList<Throwable>();
+ NamedList<NamedList> shardResponses = new NamedList<NamedList>();
Map<String, LBHttpSolrServer.Req> routes = updateRequest.getRoutes(router, col, urlMap, routableParams, this.idField);
if (routes == null) {
@@ -453,7 +453,7 @@ public class CloudSolrServer extends SolrServer {
return condensed;
}
- class RouteResponse extends NamedList {
+ public static class RouteResponse extends NamedList {
private NamedList routeResponses;
private Map<String, LBHttpSolrServer.Req> routes;
@@ -475,19 +475,19 @@ public class CloudSolrServer extends SolrServer {
}
- class RouteException extends SolrException {
+ public static class RouteException extends SolrException {
- private NamedList exceptions;
+ private NamedList<Throwable> throwables;
private Map<String, LBHttpSolrServer.Req> routes;
- public RouteException(ErrorCode errorCode, NamedList exceptions, Map<String, LBHttpSolrServer.Req> routes){
- super(errorCode, ((Exception)exceptions.getVal(0)).getMessage(), (Exception)exceptions.getVal(0));
- this.exceptions = exceptions;
+ public RouteException(ErrorCode errorCode, NamedList<Throwable> throwables, Map<String, LBHttpSolrServer.Req> routes){
+ super(errorCode, throwables.getVal(0).getMessage(), throwables.getVal(0));
+ this.throwables = throwables;
this.routes = routes;
}
- public NamedList getExceptions() {
- return exceptions;
+ public NamedList<Throwable> getThrowables() {
+ return throwables;
}
public Map<String, LBHttpSolrServer.Req> getRoutes() {