You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by jo...@apache.org on 2017/06/01 19:08:28 UTC

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

Repository: nifi
Updated Branches:
  refs/heads/master 7035694e3 -> 2595d816c


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 <jo...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/2595d816
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/2595d816
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/2595d816

Branch: refs/heads/master
Commit: 2595d816c4c9ef47a66f1aed477932c589588823
Parents: 7035694
Author: Mark Payne <ma...@hotmail.com>
Authored: Sat May 27 14:55:04 2017 -0400
Committer: joewitt <jo...@apache.org>
Committed: Thu Jun 1 15:08:12 2017 -0400

----------------------------------------------------------------------
 .../iterator/SequentialRecordReaderEventIterator.java  | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/2595d816/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/iterator/SequentialRecordReaderEventIterator.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/iterator/SequentialRecordReaderEventIterator.java b/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/iterator/SequentialRecordReaderEventIterator.java
index 869febf..98fe9cd 100644
--- a/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/iterator/SequentialRecordReaderEventIterator.java
+++ b/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/iterator/SequentialRecordReaderEventIterator.java
@@ -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;