NIFI-3986: This closes #1868. When we encounted EOFException from sequential record reader event iterator, just treat it as not having any more events

Signed-off-by: joewitt <joewitt@apache.org>
This commit is contained in:
Mark Payne 2017-05-27 14:55:04 -04:00 committed by joewitt
parent 7035694e37
commit 2595d816c4
1 changed files with 12 additions and 1 deletions

View File

@ -68,7 +68,18 @@ public class SequentialRecordReaderEventIterator implements EventIterator {
}
while (true) {
final ProvenanceEventRecord event = reader.nextRecord();
ProvenanceEventRecord event;
try {
event = reader.nextRecord();
} catch (final EOFException eof) {
// We have run out of data. Treat the same as getting back null.
// This happens particularly if reading the same file that is being
// written to (because we use a BufferedOutputStream to write to it, so we
// may read half-way through a record and then hit the end of what was
// buffered and flushed).
event = null;
}
if (event == null) {
if (rotateReader()) {
continue;