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/05/26 12:18:54 UTC

[incubator-inlong] branch master updated: [INLONG-4354][SDK] Fix NPE of the ProxyConfigEntry cluster id (#4355)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new d499a9188 [INLONG-4354][SDK] Fix NPE of the ProxyConfigEntry cluster id (#4355)
d499a9188 is described below

commit d499a9188e759d6d09424b87102396b1f3d88198
Author: xuesongxs <54...@users.noreply.github.com>
AuthorDate: Thu May 26 20:18:50 2022 +0800

    [INLONG-4354][SDK] Fix NPE of the ProxyConfigEntry cluster id (#4355)
---
 .../apache/inlong/sdk/dataproxy/config/ProxyConfigManager.java   | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/config/ProxyConfigManager.java b/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/config/ProxyConfigManager.java
index 1578cfb37..92c32e948 100644
--- a/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/config/ProxyConfigManager.java
+++ b/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/config/ProxyConfigManager.java
@@ -698,10 +698,13 @@ public class ProxyConfigManager extends Thread {
         Map<String, Integer> streamIdMap = getStreamIdMap(jsonRes);
         proxyEntry.setGroupIdNumAndStreamIdNumMap(groupIdNum, streamIdMap);
         proxyEntry.setLoad(load);
-        if (jsonRes.has("cluster_id")) {
-            proxyEntry.setClusterId(jsonRes.get("cluster_id").getAsString());
+        if (jsonRes.has("data")) {
+            JsonArray data = jsonRes.getAsJsonArray("data");
+            if (data != null) {
+                String id = data.get(0).getAsJsonObject().get("id").getAsString();
+                proxyEntry.setClusterId(id);
+            }
         }
-
         return proxyEntry;
     }