This is an automated email from the ASF dual-hosted git repository.

noble pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new 4a5182ec268 SOLR-16741: refactor Replia.State.toString() (#1549)
4a5182ec268 is described below

commit 4a5182ec268911bc42f95a4ef174b7b337b435d3
Author: Noble Paul <[email protected]>
AuthorDate: Wed Apr 12 22:17:11 2023 +1000

    SOLR-16741: refactor Replia.State.toString() (#1549)
---
 solr/solrj/src/java/org/apache/solr/common/cloud/Replica.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/Replica.java 
b/solr/solrj/src/java/org/apache/solr/common/cloud/Replica.java
index 7c2de199b4f..a336abcad60 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/Replica.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/Replica.java
@@ -78,13 +78,16 @@ public class Replica extends ZkNodeProps implements 
MapWriter {
      */
     public final String shortName;
 
+    public final String longName;
+
     State(String c) {
       this.shortName = c;
+      this.longName = super.toString().toLowerCase(Locale.ROOT);
     }
 
     @Override
     public String toString() {
-      return super.toString().toLowerCase(Locale.ROOT);
+      return longName;
     }
 
     /** Converts the state string to a State instance. */
@@ -391,7 +394,7 @@ public class Replica extends ZkNodeProps implements 
MapWriter {
       w.putIfNotNull(ReplicaStateProps.CORE_NAME, core)
           .putIfNotNull(ReplicaStateProps.NODE_NAME, node)
           .putIfNotNull(ReplicaStateProps.TYPE, type.toString())
-          .putIfNotNull(ReplicaStateProps.STATE, 
getState().toString().toLowerCase(Locale.ROOT))
+          .putIfNotNull(ReplicaStateProps.STATE, getState().toString())
           .putIfNotNull(ReplicaStateProps.LEADER, () -> isLeader() ? "true" : 
null)
           .putIfNotNull(
               ReplicaStateProps.FORCE_SET_STATE, 
propMap.get(ReplicaStateProps.FORCE_SET_STATE))

Reply via email to