MAPREDUCE-5866. Merging change r1608585 from trunk to branch-2.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1608588 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris Nauroth 2014-07-07 20:00:38 +00:00
parent 29099c8a5c
commit 00ff3d320a
3 changed files with 18 additions and 9 deletions

View File

@ -12,6 +12,9 @@ Release 2.6.0 - UNRELEASED
BUG FIXES
MAPREDUCE-5866. TestFixedLengthInputFormat fails in windows.
(Varun Vasudev via cnauroth)
Release 2.5.0 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -372,10 +372,13 @@ private static List<String> readSplit(FixedLengthInputFormat format,
format.getRecordReader(split, job, voidReporter);
LongWritable key = reader.createKey();
BytesWritable value = reader.createValue();
while (reader.next(key, value)) {
result.add(new String(value.getBytes(), 0, value.getLength()));
try {
while (reader.next(key, value)) {
result.add(new String(value.getBytes(), 0, value.getLength()));
}
} finally {
reader.close();
}
reader.close();
return result;
}

View File

@ -417,15 +417,18 @@ private static List<String> readSplit(FixedLengthInputFormat format,
new MapContextImpl<LongWritable, BytesWritable, LongWritable,
BytesWritable>(job.getConfiguration(), context.getTaskAttemptID(),
reader, null, null, MapReduceTestUtil.createDummyReporter(), split);
reader.initialize(split, mcontext);
LongWritable key;
BytesWritable value;
while (reader.nextKeyValue()) {
key = reader.getCurrentKey();
value = reader.getCurrentValue();
result.add(new String(value.getBytes(), 0, value.getLength()));
try {
reader.initialize(split, mcontext);
while (reader.nextKeyValue()) {
key = reader.getCurrentKey();
value = reader.getCurrentValue();
result.add(new String(value.getBytes(), 0, value.getLength()));
}
} finally {
reader.close();
}
reader.close();
return result;
}