Skip to content

Commit 9c8b7f0

Browse files
author
niumy
committed
Revert "[Improvement-17723][TaskPlugin] DmsTask resource leak repair"
This reverts commit e1af574.
1 parent e8175f5 commit 9c8b7f0

File tree

1 file changed

+5
-4
lines changed
  • dolphinscheduler-task-plugin/dolphinscheduler-task-dms/src/main/java/org/apache/dolphinscheduler/plugin/task/dms

1 file changed

+5
-4
lines changed

dolphinscheduler-task-plugin/dolphinscheduler-task-dms/src/main/java/org/apache/dolphinscheduler/plugin/task/dms/DmsHook.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
import org.apache.dolphinscheduler.common.thread.ThreadUtils;
2222
import org.apache.dolphinscheduler.common.utils.PropertyUtils;
2323

24+
import org.apache.commons.io.IOUtils;
25+
26+
import java.io.FileInputStream;
2427
import java.io.IOException;
2528
import java.nio.charset.StandardCharsets;
26-
import java.nio.file.Files;
27-
import java.nio.file.Paths;
2829
import java.util.Arrays;
2930
import java.util.Date;
3031
import java.util.List;
@@ -267,8 +268,8 @@ public String replaceFileParameters(String parameter) throws IOException {
267268
}
268269
if (parameter.startsWith("file://")) {
269270
String filePath = parameter.substring(7);
270-
try {
271-
return new String(Files.readAllBytes(Paths.get(filePath)), StandardCharsets.UTF_8);
271+
try (FileInputStream fis = new FileInputStream(filePath)) {
272+
return IOUtils.toString(fis, StandardCharsets.UTF_8);
272273
} catch (IOException e) {
273274
throw new IOException("Error reading file: " + filePath, e);
274275
}

0 commit comments

Comments
 (0)