skip empty files

This commit is contained in:
2017-09-24 17:12:17 +02:00
parent dc8262c37e
commit a7cd918fc6

View File

@@ -34,14 +34,19 @@ public class PdbFileIterator implements Iterator<Entry>, AutoCloseable {
if (reader == null) { if (reader == null) {
return null; return null;
} }
final Entry entry = reader.readNullableEntry(); Entry entry = reader.readNullableEntry();
if (entry == null) { while (entry == null) {
nextFile(); nextFile();
if (reader == null) { if (reader == null) {
return null; return null;
} else { } else {
return reader.readEntry().orElse(null); entry = reader.readEntry().orElse(null);
// A reader might return null, for a newly opened reader,
// if the file was created, but nothing has been written to
// disk yet.
// This might happen, because of buffering, or when an ingestion
// was cancelled.
} }
} }