NIFI-5551: If session.get() returns null, then return fron onTrigger instead of assuming that the FlowFile is non-null

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #2964.
This commit is contained in:
Mark Payne 2018-08-24 09:55:15 -04:00 committed by Pierre Villard
parent 8c0705cb6b
commit 6ceee25859

View File

@ -100,6 +100,10 @@ public class UpdateCounter extends AbstractProcessor {
@Override
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException {
FlowFile flowFile = session.get();
if (flowFile == null) {
return;
}
session.adjustCounter(context.getProperty(COUNTER_NAME).evaluateAttributeExpressions(flowFile).getValue(),
Long.parseLong(context.getProperty(DELTA).evaluateAttributeExpressions(flowFile).getValue()),
false