You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2023/03/23 11:36:48 UTC

[skywalking] branch master updated: Fix possible NPE when initialize `IntList`. (#10583)

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

kezhenxu94 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 7f169e9b26 Fix possible NPE when initialize `IntList`. (#10583)
7f169e9b26 is described below

commit 7f169e9b26afe6cca07a811c0e4c6a7d3302a561
Author: 吴晟 Wu Sheng <wu...@foxmail.com>
AuthorDate: Thu Mar 23 19:36:33 2023 +0800

    Fix possible NPE when initialize `IntList`. (#10583)
---
 docs/en/changes/changes.md                                           | 1 +
 .../apache/skywalking/oap/server/core/analysis/metrics/IntList.java  | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index 1a2ca979c8..55498f22b1 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -19,6 +19,7 @@
 * Fix K8sRetag reads the wrong k8s service from the cache due to a possible namespace mismatch.
 * [Breaking Change] Support cross-thread trace profiling. The data structure and query APIs are changed.
 * Fix PromQL HTTP API `/api/v1/labels` response missing `service` label.
+* Fix possible NPE when initialize `IntList`.
 
 #### UI
 * Revert: cpm5d function. This feature is cancelled from backend.
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/metrics/IntList.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/metrics/IntList.java
index 7315b9d31a..33b07272eb 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/metrics/IntList.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/metrics/IntList.java
@@ -24,6 +24,7 @@ import lombok.EqualsAndHashCode;
 import lombok.ToString;
 import org.apache.skywalking.oap.server.core.Const;
 import org.apache.skywalking.oap.server.core.storage.type.StorageDataComplexObject;
+import org.apache.skywalking.oap.server.library.util.StringUtil;
 
 /**
  * IntList is a serializable array list carrying int values.
@@ -65,6 +66,10 @@ public class IntList implements StorageDataComplexObject<IntList> {
 
     @Override
     public void toObject(final String data) {
+        if (StringUtil.isBlank(data)) {
+            this.data = new ArrayList<>(3);
+            return;
+        }
         String[] elements = data.split(Const.ARRAY_PARSER_SPLIT);
         this.data = new ArrayList<>(elements.length);
         for (String element : elements) {