mirror of https://github.com/apache/nifi.git
NIFI-7347: Fixed NullPointerException that can happen if a bin is merged due to timeout and has no records
Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com> This closes #4210.
This commit is contained in:
parent
c9f48e3788
commit
a61a4c2b58
|
@ -124,18 +124,18 @@ public class RecordBin {
|
|||
|
||||
logger.debug("Migrating id={} to {}", new Object[] {flowFile.getId(), this});
|
||||
|
||||
if (recordWriter == null) {
|
||||
final OutputStream rawOut = session.write(merged);
|
||||
logger.debug("Created OutputStream using session {} for {}", new Object[] {session, this});
|
||||
|
||||
this.out = new ByteCountingOutputStream(rawOut);
|
||||
|
||||
recordWriter = writerFactory.createWriter(logger, recordReader.getSchema(), out, flowFile);
|
||||
recordWriter.beginRecordSet();
|
||||
}
|
||||
|
||||
Record record;
|
||||
while ((record = recordReader.nextRecord()) != null) {
|
||||
if (recordWriter == null) {
|
||||
final OutputStream rawOut = session.write(merged);
|
||||
logger.debug("Created OutputStream using session {} for {}", new Object[] {session, this});
|
||||
|
||||
this.out = new ByteCountingOutputStream(rawOut);
|
||||
|
||||
recordWriter = writerFactory.createWriter(logger, record.getSchema(), out, flowFile);
|
||||
recordWriter.beginRecordSet();
|
||||
}
|
||||
|
||||
recordWriter.write(record);
|
||||
recordCount++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue