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

bogong pushed a commit to branch branch-2.9
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/branch-2.9 by this push:
     new 4f073541c3a [fix][broker] Fix if dynamicConfig item in ZK do not exist 
in broker cause NPE (#17705)
4f073541c3a is described below

commit 4f073541c3a0c59d46fc1c94f7df2b07670f89bc
Author: Lei Zhiyuan <[email protected]>
AuthorDate: Mon Sep 19 20:33:05 2022 +0800

    [fix][broker] Fix if dynamicConfig item in ZK do not exist in broker cause 
NPE (#17705)
    
    (cherry picked from commit 8bc02aa9829ab7f0ab926b57a927a0da3d153f71)
---
 .../main/java/org/apache/pulsar/broker/service/BrokerService.java    | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
index 319891c2792..110eccbf0ab 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
@@ -2000,8 +2000,8 @@ public class BrokerService implements Closeable {
                     Map<String, String> data = optMap.get();
                     data.forEach((configKey, value) -> {
                         Field configField = 
dynamicConfigurationMap.get(configKey).field;
-                        Object newValue = 
FieldParser.value(data.get(configKey), configField);
                         if (configField != null) {
+                            Object newValue = 
FieldParser.value(data.get(configKey), configField);
                             Consumer listener = 
configRegisteredListeners.get(configKey);
                             try {
                                 Object existingValue = 
configField.get(pulsar.getConfiguration());
@@ -2015,7 +2015,8 @@ public class BrokerService implements Closeable {
                                 log.error("Failed to update config {}/{}", 
configKey, newValue);
                             }
                         } else {
-                            log.error("Found non-dynamic field in 
dynamicConfigMap {}/{}", configKey, newValue);
+                            log.error("Found non-dynamic field in 
dynamicConfigMap {}/{}",
+                                    configKey, data.get(configKey));
                         }
                     });
                 });

Reply via email to