You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wa...@apache.org on 2025/06/17 08:00:06 UTC
(skywalking) branch master updated: chore: Fix NPE if no TopN rules (#13320)
This is an automated email from the ASF dual-hosted git repository.
wankai 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 57746c24d3 chore: Fix NPE if no TopN rules (#13320)
57746c24d3 is described below
commit 57746c24d3fd831835a3709ea3078fa26928f54e
Author: Wan Kai <wa...@foxmail.com>
AuthorDate: Tue Jun 17 16:00:01 2025 +0800
chore: Fix NPE if no TopN rules (#13320)
---
.../oap/server/storage/plugin/banyandb/BanyanDBConfigLoader.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBConfigLoader.java b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBConfigLoader.java
index 0104aa1177..61bd45697b 100644
--- a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBConfigLoader.java
+++ b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBConfigLoader.java
@@ -38,15 +38,13 @@ import static org.apache.skywalking.oap.server.library.util.YamlConfigLoaderUtil
@Slf4j
public class BanyanDBConfigLoader {
private final ModuleProvider moduleProvider;
- private BanyanDBStorageConfig config;
+ private final BanyanDBStorageConfig config;
private final Yaml yaml;
- private final Yaml topNYaml;
public BanyanDBConfigLoader(final ModuleProvider moduleProvider) {
this.moduleProvider = moduleProvider;
this.config = new BanyanDBStorageConfig();
this.yaml = new Yaml();
- this.topNYaml = new Yaml();
}
public BanyanDBStorageConfig loadConfig() throws ModuleStartException {
@@ -199,11 +197,14 @@ public class BanyanDBConfigLoader {
} catch (FileNotFoundException e) {
throw new ModuleStartException("Cannot find the BanyanDB topN configuration file [bydb-topn.yml].", e);
}
- Map<String, List<Map<String, ?>>> configMap = yaml.loadAs(applicationReader, Map.class);
+ Map<String, List<Map<String, ?>>> configMap = new Yaml().loadAs(applicationReader, Map.class);
if (configMap == null) {
return;
}
List<Map<String, ?>> topNConfig = configMap.get("TopN-Rules");
+ if (topNConfig == null) {
+ return;
+ }
for (Map<String, ?> rule : topNConfig) {
TopN topN = new TopN();
var name = rule.get("name");