You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by te...@apache.org on 2022/09/20 09:01:00 UTC

[pulsar] branch branch-2.11 updated: [fix][broker] Fix if dynamicConfig item in ZK do not exist in broker cause NPE (#17705)

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

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


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

commit 8a52bb0eac87cdacc397225116157f302195dd33
Author: Lei Zhiyuan <le...@gmail.com>
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)
---
 .../main/java/org/apache/pulsar/broker/service/BrokerService.java  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

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 a45b75a2284..48f3713f5cb 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
@@ -2100,7 +2100,12 @@ public class BrokerService implements Closeable {
                         }
                         Map<String, String> data = optMap.get();
                         data.forEach((configKey, value) -> {
-                            Field configField = dynamicConfigurationMap.get(configKey).field;
+                            ConfigField configFieldWrapper = dynamicConfigurationMap.get(configKey);
+                            if (configFieldWrapper == null) {
+                                log.warn("{} does not exist in dynamicConfigurationMap, skip this config.", configKey);
+                                return;
+                            }
+                            Field configField = configFieldWrapper.field;
                             Object newValue = FieldParser.value(data.get(configKey), configField);
                             if (configField != null) {
                                 Consumer listener = configRegisteredListeners.get(configKey);