You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by an...@apache.org on 2022/09/23 02:35:13 UTC

[solr-sandbox] branch crossdc-wip updated: Allow empty string as a config property value. (#43)

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

anshum 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 07dbc99  Allow empty string as a config property value. (#43)
07dbc99 is described below

commit 07dbc99e0cbceac87ea1012f8de25b8e1147f0f7
Author: Mark Robert Miller <ma...@apache.org>
AuthorDate: Thu Sep 22 21:35:08 2022 -0500

    Allow empty string as a config property value. (#43)
---
 .../main/java/org/apache/solr/crossdc/consumer/Consumer.java   | 10 +++++-----
 .../processor/MirroringUpdateRequestProcessorFactory.java      |  6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/crossdc-consumer/src/main/java/org/apache/solr/crossdc/consumer/Consumer.java b/crossdc-consumer/src/main/java/org/apache/solr/crossdc/consumer/Consumer.java
index f20dacd..7a061f9 100644
--- a/crossdc-consumer/src/main/java/org/apache/solr/crossdc/consumer/Consumer.java
+++ b/crossdc-consumer/src/main/java/org/apache/solr/crossdc/consumer/Consumer.java
@@ -62,9 +62,9 @@ public class Consumer {
 
         log.info("Consumer startup config properties before adding additional properties from Zookeeper={}", properties);
 
-        String zkConnectString = (String) properties.get(KafkaCrossDcConf.ZK_CONNECT_STRING);
-        if (zkConnectString == null || zkConnectString.isBlank()) {
-            throw new IllegalArgumentException("zkConnectString not specified for Consumer");
+        String zkConnectString = (String) properties.get("zkConnectString");
+        if (zkConnectString == null) {
+            throw new IllegalArgumentException("zkConnectString not specified for producer");
         }
 
         try (SolrZkClient client = new SolrZkClient(zkConnectString, 15000)) {
@@ -88,12 +88,12 @@ public class Consumer {
         }
 
         String bootstrapServers = (String) properties.get(KafkaCrossDcConf.BOOTSTRAP_SERVERS);
-        if (bootstrapServers == null || bootstrapServers.isBlank()) {
+        if (bootstrapServers == null) {
             throw new IllegalArgumentException("bootstrapServers not specified for Consumer");
         }
 
         String topicName = (String) properties.get(TOPIC_NAME);
-        if (topicName == null || topicName.isBlank()) {
+        if (topicName == null) {
             throw new IllegalArgumentException("topicName not specified for Consumer");
         }
 
diff --git a/crossdc-producer/src/main/java/org/apache/solr/update/processor/MirroringUpdateRequestProcessorFactory.java b/crossdc-producer/src/main/java/org/apache/solr/update/processor/MirroringUpdateRequestProcessorFactory.java
index 654be15..c045f86 100644
--- a/crossdc-producer/src/main/java/org/apache/solr/update/processor/MirroringUpdateRequestProcessorFactory.java
+++ b/crossdc-producer/src/main/java/org/apache/solr/update/processor/MirroringUpdateRequestProcessorFactory.java
@@ -85,7 +85,7 @@ public class MirroringUpdateRequestProcessorFactory extends UpdateRequestProcess
 
         for (ConfigProperty configKey : KafkaCrossDcConf.CONFIG_PROPERTIES) {
             String val = args._getStr(configKey.getKey(), null);
-            if (val != null) {
+            if (val != null && !val.isBlank()) {
                 properties.put(configKey.getKey(), val);
             }
         }
@@ -162,14 +162,14 @@ public class MirroringUpdateRequestProcessorFactory extends UpdateRequestProcess
             throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Exception looking for CrossDC configuration in Zookeeper", e);
         }
 
-        if (properties.get(BOOTSTRAP_SERVERS) == null || ((String)properties.get(BOOTSTRAP_SERVERS)).isBlank()) {
+        if (properties.get(BOOTSTRAP_SERVERS) == null) {
             log.error(
                 "boostrapServers not specified for producer in CrossDC configuration props={} zkProps={}",
                 properties, zkProps);
            throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "boostrapServers not specified for producer");
        }
         
-        if (properties.get(TOPIC_NAME) == null || ((String)properties.get(TOPIC_NAME)).isBlank()) {
+        if (properties.get(TOPIC_NAME) == null) {
             log.error(
                 "topicName not specified for producer in CrossDC configuration props={} zkProps={}",
                 properties, zkProps);