MAPREDUCE-6045. need close the DataInputStream after open it in TestMapReduce.java (zxu via rkanter)

This commit is contained in:
Robert Kanter 2014-12-19 11:59:22 -08:00
parent a4876c130f
commit d9e4d67d18
2 changed files with 11 additions and 4 deletions

View File

@ -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

View File

@ -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;
}