From 6a9ccd809bbc9d5f9cf1d75bf4819b211619440a Mon Sep 17 00:00:00 2001 From: Suresh Srinivas Date: Tue, 12 Mar 2013 17:26:38 +0000 Subject: [PATCH] HADOOP-9388. TestFsShellCopy fails on Windows. Contributed by Ivan Mitic. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1455637 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 2 ++ .../apache/hadoop/fs/shell/CommandWithDestination.java | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 4757a763fd0..2dfde4a8d7d 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -478,6 +478,8 @@ Trunk (Unreleased) HADOOP-8973. DiskChecker cannot reliably detect an inaccessible disk on Windows with NTFS ACLs. (Chris Nauroth via suresh) + + HADOOP-9388. TestFsShellCopy fails on Windows. (Ivan Mitic via suresh) Release 2.0.5-beta - UNRELEASED diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CommandWithDestination.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CommandWithDestination.java index 7540163f35b..0e9874bf9eb 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CommandWithDestination.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CommandWithDestination.java @@ -18,7 +18,6 @@ package org.apache.hadoop.fs.shell; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URI; @@ -224,7 +223,13 @@ abstract class CommandWithDestination extends FsCommand { */ protected void copyFileToTarget(PathData src, PathData target) throws IOException { src.fs.setVerifyChecksum(verifyChecksum); - copyStreamToTarget(src.fs.open(src.path), target); + InputStream in = null; + try { + in = src.fs.open(src.path); + copyStreamToTarget(in, target); + } finally { + IOUtils.closeStream(in); + } } /**