From d9e4d67d18811e16d5b0a76ea8228d333ded195f Mon Sep 17 00:00:00 2001 From: Robert Kanter Date: Fri, 19 Dec 2014 11:59:22 -0800 Subject: [PATCH] MAPREDUCE-6045. need close the DataInputStream after open it in TestMapReduce.java (zxu via rkanter) --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../org/apache/hadoop/mapreduce/TestMapReduce.java | 12 ++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 41fdb4f295..18270f68ca 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -285,6 +285,9 @@ Release 2.7.0 - UNRELEASED MAPREDUCE-6166. Reducers do not validate checksum of map outputs when fetching directly to disk. (Eric Payne via gera) + MAPREDUCE-6045. need close the DataInputStream after open it in + TestMapReduce.java (zxu via rkanter) + Release 2.6.0 - 2014-11-18 INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/TestMapReduce.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/TestMapReduce.java index 48ad47af22..912f0e352f 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/TestMapReduce.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/TestMapReduce.java @@ -465,11 +465,15 @@ private static void printSequenceFile(FileSystem fs, Path p, private static boolean isSequenceFile(FileSystem fs, Path f) throws IOException { DataInputStream in = fs.open(f); - byte[] seq = "SEQ".getBytes(); - for(int i=0; i < seq.length; ++i) { - if (seq[i] != in.read()) { - return false; + try { + byte[] seq = "SEQ".getBytes(); + for (int i = 0; i < seq.length; ++i) { + if (seq[i] != in.read()) { + return false; + } } + } finally { + in.close(); } return true; }