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

markrmiller pushed a commit to branch crossdc-wip
in repository https://gitbox.apache.org/repos/asf/solr-sandbox.git


The following commit(s) were added to refs/heads/crossdc-wip by this push:
     new 946ebab  Cleanup Kafka config class. (#40)
946ebab is described below

commit 946ebab3ad6726a0fbe2389384338ca90a129c92
Author: Mark Robert Miller <[email protected]>
AuthorDate: Wed Sep 14 17:45:25 2022 -0500

    Cleanup Kafka config class. (#40)
---
 .../solr/crossdc/common/KafkaCrossDcConf.java      | 24 +++++++++++-----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git 
a/crossdc-commons/src/main/java/org/apache/solr/crossdc/common/KafkaCrossDcConf.java
 
b/crossdc-commons/src/main/java/org/apache/solr/crossdc/common/KafkaCrossDcConf.java
index 85feb75..44c4e04 100644
--- 
a/crossdc-commons/src/main/java/org/apache/solr/crossdc/common/KafkaCrossDcConf.java
+++ 
b/crossdc-commons/src/main/java/org/apache/solr/crossdc/common/KafkaCrossDcConf.java
@@ -207,9 +207,8 @@ public class KafkaCrossDcConf extends CrossDcConf {
     return prop.getValueAsBoolean(properties);
   }
   
-  public Properties getAdditionalProperties() {
-    Properties additional = new Properties();
-    additional.putAll(properties);
+  public Map<String,Object> getAdditionalProperties() {
+    Map<String, Object> additional = new HashMap<>(properties);
     for (ConfigProperty configProperty : CONFIG_PROPERTIES) {
       additional.remove(configProperty.getKey());
     }
@@ -222,22 +221,20 @@ public class KafkaCrossDcConf extends CrossDcConf {
 
       }
     });
-    integerProperties.forEach((key, v) -> {
-      additional.setProperty(key, (String) v);
-    });
+    additional.putAll(integerProperties);
     return additional;
   }
 
   public static void readZkProps(Map<String,Object> properties, Properties 
zkProps) {
-    Properties zkPropsUnproccessed = new Properties(zkProps);
+    Map<Object, Object> zkPropsUnprocessed = new HashMap<>(zkProps);
     for (ConfigProperty configKey : KafkaCrossDcConf.CONFIG_PROPERTIES) {
       if (properties.get(configKey.getKey()) == null || 
((String)properties.get(configKey.getKey())).isBlank()) {
         properties.put(configKey.getKey(), (String) zkProps.getProperty(
             configKey.getKey()));
-        zkPropsUnproccessed.remove(configKey.getKey());
+        zkPropsUnprocessed.remove(configKey.getKey());
       }
     }
-    zkPropsUnproccessed.forEach((key, val) -> {
+    zkPropsUnprocessed.forEach((key, val) -> {
       if (properties.get(key) == null) {
         properties.put((String) key, (String) val);
       }
@@ -247,10 +244,13 @@ public class KafkaCrossDcConf extends CrossDcConf {
   @Override public String toString() {
     StringBuilder sb = new StringBuilder(128);
     for (ConfigProperty configProperty : CONFIG_PROPERTIES) {
-      sb.append(configProperty.getKey()).append("=")
-          .append(properties.get(configProperty.getKey())).append(",");
+      if (properties.get(configProperty.getKey()) != null) {
+        
sb.append(configProperty.getKey()).append("=").append(properties.get(configProperty.getKey())).append(",");
+      }
+    }
+    if (sb.length() > 0) {
+      sb.setLength(sb.length() - 1);
     }
-    sb.setLength(sb.length() - 1);
 
     return "KafkaCrossDcConf{" + sb + "}";
   }

Reply via email to