Repository: camel Updated Branches: refs/heads/camel-2.13.x 2260a1d4e -> aae2e24d2 refs/heads/master 64920052f -> 337f247f5
CAMEL-8032: FileUtil leaks FileInputStream when renameFile fails due to permission issue. Thanks to Joe Luo for the patch. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/337f247f Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/337f247f Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/337f247f Branch: refs/heads/master Commit: 337f247f5882ad17aa471c24940ce0bf876ff153 Parents: 6492005 Author: Claus Ibsen <[email protected]> Authored: Tue Nov 11 14:13:45 2014 +0100 Committer: Claus Ibsen <[email protected]> Committed: Tue Nov 11 14:13:45 2014 +0100 ---------------------------------------------------------------------- camel-core/src/main/java/org/apache/camel/util/FileUtil.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/337f247f/camel-core/src/main/java/org/apache/camel/util/FileUtil.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/util/FileUtil.java b/camel-core/src/main/java/org/apache/camel/util/FileUtil.java index 128c600..61694e3 100644 --- a/camel-core/src/main/java/org/apache/camel/util/FileUtil.java +++ b/camel-core/src/main/java/org/apache/camel/util/FileUtil.java @@ -460,9 +460,11 @@ public final class FileUtil { } public static void copyFile(File from, File to) throws IOException { - FileChannel in = new FileInputStream(from).getChannel(); - FileChannel out = new FileOutputStream(to).getChannel(); + FileChannel in = null; + FileChannel out = null; try { + in = new FileInputStream(from).getChannel(); + out = new FileOutputStream(to).getChannel(); if (LOG.isTraceEnabled()) { LOG.trace("Using FileChannel to copy from: " + in + " to: " + out); }
