diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 9bf245d49b4..596d63ec334 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -174,6 +174,8 @@ Other Changes recovery scenarios after the leader receives an error trying to forward an update request to a replica. (Timothy Potter) +* SOLR-6116: Refactor DocRouter.getDocRouter to accept routerName as a String. (shalin) + Optimizations ---------------------- diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java index e5bd28b9f8d..e4a846520ab 100644 --- a/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java +++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java @@ -303,7 +303,7 @@ public class ClusterState implements JSONWriter.Writable { router = DocRouter.getDocRouter((String)routerObj); } else { Map routerProps = (Map)routerObj; - router = DocRouter.getDocRouter(routerProps.get("name")); + router = DocRouter.getDocRouter((String) routerProps.get("name")); } return new DocCollection(name, slices, props, router, version); diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/DocRouter.java b/solr/solrj/src/java/org/apache/solr/common/cloud/DocRouter.java index 088d272a26c..e062c8845a9 100644 --- a/solr/solrj/src/java/org/apache/solr/common/cloud/DocRouter.java +++ b/solr/solrj/src/java/org/apache/solr/common/cloud/DocRouter.java @@ -43,7 +43,7 @@ public abstract class DocRouter { public static final DocRouter DEFAULT = new CompositeIdRouter(); - public static DocRouter getDocRouter(Object routerName) { + public static DocRouter getDocRouter(String routerName) { DocRouter router = routerMap.get(routerName); if (router != null) return router; throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown document router '"+ routerName + "'");