You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2021/08/31 00:39:44 UTC
[skywalking] branch master updated: Fix
`ZookeeperConfigWatcherRegister.readConfig()` could cause `NPE` when
`data.getData()` is null (#7611)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new 313edd3 Fix `ZookeeperConfigWatcherRegister.readConfig()` could cause `NPE` when `data.getData()` is null (#7611)
313edd3 is described below
commit 313edd309762dbd6297dbb66ba5c0268103b36a5
Author: wankai123 <wa...@foxmail.com>
AuthorDate: Tue Aug 31 08:39:28 2021 +0800
Fix `ZookeeperConfigWatcherRegister.readConfig()` could cause `NPE` when `data.getData()` is null (#7611)
---
CHANGES.md | 1 +
.../configuration/zookeeper/ZookeeperConfigWatcherRegister.java | 6 +++++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/CHANGES.md b/CHANGES.md
index 26fa18f..aaeefb1 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -48,6 +48,7 @@ Release Notes.
by `agent-analyzer.default.traceSamplingPolicySettingsFile`.
* Fix dynamic configuration watch implementation current value not null when the config is deleted.
* Fix `LoggingConfigWatcher` return `watch.value` would not consistent with the real configuration content.
+* Fix `ZookeeperConfigWatcherRegister.readConfig()` could cause `NPE` when `data.getData()` is null.
#### UI
diff --git a/oap-server/server-configuration/configuration-zookeeper/src/main/java/org/apache/skywalking/oap/server/configuration/zookeeper/ZookeeperConfigWatcherRegister.java b/oap-server/server-configuration/configuration-zookeeper/src/main/java/org/apache/skywalking/oap/server/configuration/zookeeper/ZookeeperConfigWatcherRegister.java
index 104d6cc..fe9d07d 100644
--- a/oap-server/server-configuration/configuration-zookeeper/src/main/java/org/apache/skywalking/oap/server/configuration/zookeeper/ZookeeperConfigWatcherRegister.java
+++ b/oap-server/server-configuration/configuration-zookeeper/src/main/java/org/apache/skywalking/oap/server/configuration/zookeeper/ZookeeperConfigWatcherRegister.java
@@ -52,7 +52,11 @@ public class ZookeeperConfigWatcherRegister extends ConfigWatcherRegister {
ConfigTable table = new ConfigTable();
keys.forEach(s -> {
ChildData data = this.childrenCache.getCurrentData(this.prefix + s);
- table.add(new ConfigTable.ConfigItem(s, data == null ? null : new String(data.getData())));
+ String itemValue = null;
+ if (data != null && data.getData() != null) {
+ itemValue = new String(data.getData());
+ }
+ table.add(new ConfigTable.ConfigItem(s, itemValue));
});
return Optional.of(table);
}