NIFI-1404: Fixed NPE that resulted on startup if there was a Provenance file that had no events

Signed-off-by: joewitt <joewitt@apache.org>
This commit is contained in:
Mark Payne 2016-01-25 16:48:56 -05:00 committed by joewitt
parent fca0b4c433
commit 925138b6c4
1 changed files with 3 additions and 1 deletions

View File

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