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/07/06 02:26:43 UTC

[inlong] branch master updated: [INLONG-4871][SDK] The generateMd5 method generate md2 not md5 (#4872)

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/inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new c6607d38b [INLONG-4871][SDK] The generateMd5 method generate md2 not md5 (#4872)
c6607d38b is described below

commit c6607d38b7912044fe6fb6f4a10902e9ec5d03dd
Author: 宁培培 <ni...@163.com>
AuthorDate: Wed Jul 6 10:26:38 2022 +0800

    [INLONG-4871][SDK] The generateMd5 method generate md2 not md5 (#4872)
---
 .../config/pojo/GetProxyConfigByAgentResponse.java  | 21 +--------------------
 .../pb/config/pojo/ProxyClusterConfig.java          | 14 ++++++++++++--
 2 files changed, 13 insertions(+), 22 deletions(-)

diff --git a/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/pb/config/pojo/GetProxyConfigByAgentResponse.java b/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/pb/config/pojo/GetProxyConfigByAgentResponse.java
index 829975a00..bb3702b95 100644
--- a/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/pb/config/pojo/GetProxyConfigByAgentResponse.java
+++ b/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/pb/config/pojo/GetProxyConfigByAgentResponse.java
@@ -20,10 +20,6 @@ package org.apache.inlong.sdk.dataproxy.pb.config.pojo;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.codec.digest.DigestUtils;
-
-import com.alibaba.fastjson.JSON;
-
 /**
  * 
  * GetProxyConfigByAgentResponse
@@ -119,24 +115,9 @@ public class GetProxyConfigByAgentResponse {
         response.setData(new ArrayList<>());
         ProxyClusterConfig cluster = ProxyClusterConfig.getExample();
         response.getData().add(cluster);
-        String md5 = GetProxyConfigByAgentResponse.generateMd5(response.getData());
+        String md5 = ProxyClusterConfig.generateMd5(response.getData());
         response.setMd5(md5);
         return response;
     }
 
-    /**
-     * generateMd5
-     * 
-     * @param  configList
-     * @return
-     */
-    public static String generateMd5(List<ProxyClusterConfig> configList) {
-        String md5 = DigestUtils.md2Hex(JSON.toJSONString(configList));
-        return md5;
-    }
-
-    public static void main(String[] args) {
-        GetProxyConfigByAgentResponse data = GetProxyConfigByAgentResponse.getExample();
-        System.out.println(JSON.toJSONString(data));
-    }
 }
diff --git a/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/pb/config/pojo/ProxyClusterConfig.java b/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/pb/config/pojo/ProxyClusterConfig.java
index 414475734..fbf3dda70 100644
--- a/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/pb/config/pojo/ProxyClusterConfig.java
+++ b/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/pb/config/pojo/ProxyClusterConfig.java
@@ -161,7 +161,17 @@ public class ProxyClusterConfig {
      * @return
      */
     public static String generateMd5(ProxyClusterConfig config) {
-        String md5 = DigestUtils.md2Hex(JSON.toJSONString(config));
-        return md5;
+        return DigestUtils.md5Hex(JSON.toJSONString(config));
     }
+
+    /**
+     * generateMd5
+     * 
+     * @param  configList
+     * @return
+     */
+    public static String generateMd5(List<ProxyClusterConfig> configList) {
+        return DigestUtils.md5Hex(JSON.toJSONString(configList));
+    }
+
 }