This is an automated email from the ASF dual-hosted git repository.
noble pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new 27f69db8827 SOLR-16741: refactor Replia.State.toString() (#1549)
27f69db8827 is described below
commit 27f69db8827de39d40be39f1e397841b874e1570
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))