ruanwenjun commented on code in PR #17718:
URL: 
https://github.com/apache/dolphinscheduler/pull/17718#discussion_r2591181832


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-dms/src/main/java/org/apache/dolphinscheduler/plugin/task/dms/DmsHook.java:
##########
@@ -141,10 +141,19 @@ public void stopReplicationTask() {
         if (replicationTaskArn == null) {
             return;
         }
-        StopReplicationTaskRequest request = new StopReplicationTaskRequest()
-                .withReplicationTaskArn(replicationTaskArn);
-        client.stopReplicationTask(request);
-        awaitReplicationTaskStatus(STATUS.STOPPED);
+        try {
+            StopReplicationTaskRequest request = new 
StopReplicationTaskRequest()
+                    .withReplicationTaskArn(replicationTaskArn);
+            client.stopReplicationTask(request);
+            awaitReplicationTaskStatus(STATUS.STOPPED);
+        } catch (Exception e) {
+            log.error("stopReplicationTask error: ", e);
+        } finally {
+            if (client != null) {
+                // shutdown client
+                client.shutdown();
+            }
+        }

Review Comment:
   Revert this change.



##########
dolphinscheduler-task-plugin/dolphinscheduler-task-dms/src/main/java/org/apache/dolphinscheduler/plugin/task/dms/DmsHook.java:
##########
@@ -268,8 +277,8 @@ public String replaceFileParameters(String parameter) 
throws IOException {
         }
         if (parameter.startsWith("file://")) {
             String filePath = parameter.substring(7);
-            try {
-                return IOUtils.toString(new FileInputStream(filePath), 
StandardCharsets.UTF_8);
+            try (FileInputStream fis = new FileInputStream(filePath)) {
+                return IOUtils.toString(fis, StandardCharsets.UTF_8);

Review Comment:
   Use Files.readString is better?



-- 
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