You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2014/11/11 14:15:18 UTC
camel git commit: CAMEL-8032: FileUtil leaks FileInputStream when
renameFile fails due to permission issue. Thanks to Joe Luo for the patch.
Repository: camel
Updated Branches:
refs/heads/camel-2.14.x 1a56b41d4 -> 55e096c05
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/55e096c0
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/55e096c0
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/55e096c0
Branch: refs/heads/camel-2.14.x
Commit: 55e096c05c7af3438922d8361fe9ecf8d96a50c3
Parents: 1a56b41
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Nov 11 14:13:45 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Nov 11 14:15:10 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/55e096c0/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);
}