Skip to content

Commit 064e77a

Browse files
authored
Merge pull request #1449 from hazendaz/tests
[ci] Fix suspected memory leak
2 parents 272283f + cc227af commit 064e77a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/main/java/org/apache/ibatis/io/ExternalResources.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.io.FileNotFoundException;
2121
import java.io.FileOutputStream;
2222
import java.io.IOException;
23-
import java.nio.channels.FileChannel;
2423
import java.util.Properties;
2524

2625
import org.apache.ibatis.logging.Log;
@@ -43,9 +42,9 @@ public static void copyExternalResource(File sourceFile, File destFile) throws I
4342
destFile.createNewFile();
4443
}
4544

46-
try (FileChannel source = new FileInputStream(sourceFile).getChannel();
47-
FileChannel destination = new FileOutputStream(destFile).getChannel()){
48-
destination.transferFrom(source, 0, source.size());
45+
try (FileInputStream source = new FileInputStream(sourceFile);
46+
FileOutputStream destination = new FileOutputStream(destFile)) {
47+
destination.getChannel().transferFrom(source.getChannel(), 0, source.getChannel().size());
4948
}
5049

5150
}

0 commit comments

Comments
 (0)