From 04b74eddc67888142879ed114d21348e8a4aad78 Mon Sep 17 00:00:00 2001 From: Gera Shegalov Date: Tue, 12 Jun 2018 11:21:51 -0700 Subject: [PATCH] MAPREDUCE-7108. TestFileOutputCommitter fails on Windows. (Zuoming Zhang via gera) --- .../lib/output/TestFileOutputCommitter.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/lib/output/TestFileOutputCommitter.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/lib/output/TestFileOutputCommitter.java index cd9d44b936d..fc43dce1830 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/lib/output/TestFileOutputCommitter.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/lib/output/TestFileOutputCommitter.java @@ -40,6 +40,7 @@ import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.FileUtil; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.RawLocalFileSystem; +import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.MapFile; import org.apache.hadoop.io.NullWritable; @@ -526,16 +527,15 @@ public class TestFileOutputCommitter { // Ensure getReaders call works and also ignores // hidden filenames (_ or . prefixes) + MapFile.Reader[] readers = {}; try { - MapFileOutputFormat.getReaders(outDir, conf); - } catch (Exception e) { - fail("Fail to read from MapFileOutputFormat: " + e); - e.printStackTrace(); + readers = MapFileOutputFormat.getReaders(outDir, conf); + // validate output + validateMapFileOutputContent(FileSystem.get(job.getConfiguration()), outDir); + } finally { + IOUtils.cleanupWithLogger(null, readers); + FileUtil.fullyDelete(new File(outDir.toString())); } - - // validate output - validateMapFileOutputContent(FileSystem.get(job.getConfiguration()), outDir); - FileUtil.fullyDelete(new File(outDir.toString())); } @Test