NIFI-8720: Ensure that when we use Expression Language for Records Per Split property of SplitRecord, we treat the result as a value of 1 if it's less than 1.

Signed-off-by: Matthew Burgess <mattyb149@apache.org>

This closes #5171
This commit is contained in:
Mark Payne 2021-06-21 10:38:13 -04:00 committed by Matthew Burgess
parent b1ad13c835
commit 6fc9f33ba2
No known key found for this signature in database
GPG Key ID: 05D3DEB8126DAD24

View File

@ -144,7 +144,7 @@ public class SplitRecord extends AbstractProcessor {
final RecordReaderFactory readerFactory = context.getProperty(RECORD_READER).asControllerService(RecordReaderFactory.class);
final RecordSetWriterFactory writerFactory = context.getProperty(RECORD_WRITER).asControllerService(RecordSetWriterFactory.class);
final int maxRecords = context.getProperty(RECORDS_PER_SPLIT).evaluateAttributeExpressions(original).asInteger();
final int maxRecords = Math.max(1, context.getProperty(RECORDS_PER_SPLIT).evaluateAttributeExpressions(original).asInteger());
final List<FlowFile> splits = new ArrayList<>();
final Map<String, String> originalAttributes = original.getAttributes();