You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by do...@apache.org on 2022/11/15 07:58:01 UTC

[inlong] 02/06: [INLONG-6515][Manager] Fix the NPE for the cache configuration of DataProxy (#6519)

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

dockerzhang pushed a commit to branch branch-1.4
in repository https://gitbox.apache.org/repos/asf/inlong.git

commit 2a1ecf7864878fb0eedc00902da078e4e57b598e
Author: seedscoder <se...@gmail.com>
AuthorDate: Mon Nov 14 11:51:26 2022 +0800

    [INLONG-6515][Manager] Fix the NPE for the cache configuration of DataProxy (#6519)
---
 .../inlong/manager/service/repository/DataProxyConfigRepository.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/repository/DataProxyConfigRepository.java b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/repository/DataProxyConfigRepository.java
index 55a5e7c85..3e93612cb 100644
--- a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/repository/DataProxyConfigRepository.java
+++ b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/repository/DataProxyConfigRepository.java
@@ -68,6 +68,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Objects;
 import java.util.Optional;
 import java.util.Timer;
 import java.util.TimerTask;
@@ -299,6 +300,10 @@ public class DataProxyConfigRepository implements IRepository {
         Map<String, String> mapObj = new HashMap<>();
         try {
             JsonObject obj = gson.fromJson(jsonString, JsonObject.class);
+            // when jsonString is null or empty str, The return value parameter will become null
+            if (Objects.isNull(obj)) {
+                return mapObj;
+            }
             for (String key : obj.keySet()) {
                 JsonElement child = obj.get(key);
                 if (child.isJsonPrimitive()) {