aloyszhang commented on code in PR #9901:
URL: https://github.com/apache/inlong/pull/9901#discussion_r1544152283


##########
inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java:
##########
@@ -233,4 +282,28 @@ public void join() {
     public void stop() throws Exception {
         waitForTerminate();
     }
+
+    private static String calcFileMd5(String path) {
+        BigInteger bi = null;
+        try {
+            byte[] buffer = new byte[DOWNLOAD_PACKAGE_READ_BUFF_SIZE];
+            int len = 0;
+            MessageDigest md = MessageDigest.getInstance("MD5");
+            File f = new File(path);
+            FileInputStream fis = new FileInputStream(f);
+            while ((len = fis.read(buffer)) != -1) {
+                md.update(buffer, 0, len);
+            }
+            fis.close();

Review Comment:
   resource should be released in `finally` block or use the try-with-resource 
to close it automatically



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to