From 925138b6c443ca5e2b9129c379298d6e99582d8e Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Mon, 25 Jan 2016 16:48:56 -0500 Subject: [PATCH] NIFI-1404: Fixed NPE that resulted on startup if there was a Provenance file that had no events Signed-off-by: joewitt --- .../nifi/provenance/PersistentProvenanceRepository.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/PersistentProvenanceRepository.java b/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/PersistentProvenanceRepository.java index 2b7843a317..3d24d11385 100644 --- a/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/PersistentProvenanceRepository.java +++ b/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/PersistentProvenanceRepository.java @@ -1028,7 +1028,9 @@ public class PersistentProvenanceRepository implements ProvenanceEventRepository for (final File logFile : logFiles) { try (final RecordReader reader = RecordReaders.newRecordReader(logFile, null, Integer.MAX_VALUE)) { final StandardProvenanceEventRecord event = reader.nextRecord(); - return event.getEventTime(); + if (event != null) { + return event.getEventTime(); + } } catch (final IOException ioe) { logger.warn("Failed to obtain timestamp of first event from Provenance Event Log File {}", logFile); }