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 62129b7e43 [INLONG-9990][Agent] Avoid MD5 calculation functions
directly returning (#9991)
62129b7e43 is described below
commit 62129b7e43ed59e9e32f3acb42a56311702ba340
Author: justinwwhuang <[email protected]>
AuthorDate: Mon Apr 15 20:31:34 2024 +0800
[INLONG-9990][Agent] Avoid MD5 calculation functions directly returning
(#9991)
---
.../main/java/org/apache/inlong/agent/installer/ModuleManager.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git
a/inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java
b/inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java
index 4e95703360..626c8985e7 100755
---
a/inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java
+++
b/inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java
@@ -478,18 +478,19 @@ public class ModuleManager extends AbstractDaemon {
private static String calcFileMd5(String path) {
byte[] buffer = new byte[DOWNLOAD_PACKAGE_READ_BUFF_SIZE];
int len = 0;
+ String ret = null;
try (FileInputStream fileInputStream = new FileInputStream(path)) {
MessageDigest md = MessageDigest.getInstance("MD5");
while ((len = fileInputStream.read(buffer)) != -1) {
md.update(buffer, 0, len);
}
- return new String(Hex.encodeHex(md.digest()));
+ ret = new String(Hex.encodeHex(md.digest()));
} catch (NoSuchAlgorithmException e) {
LOGGER.error("calc file md5 NoSuchAlgorithmException", e);
- return "";
+
} catch (IOException e) {
LOGGER.error("calc file md5 IOException", e);
- return "";
}
+ return ret;
}
}