diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/ControllerStatusReportingTask.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/ControllerStatusReportingTask.java index a196c4f642..93660baafe 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/ControllerStatusReportingTask.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/ControllerStatusReportingTask.java @@ -204,27 +204,29 @@ public class ControllerStatusReportingTask extends AbstractReportingTask { for (final ProcessorStatus processorStatus : processorStatuses) { final Map counters = processorStatus.getCounters(); - for (final Map.Entry entry : counters.entrySet()) { - final String counterName = entry.getKey(); - final Long counterValue = entry.getValue() / divisor; + if (counters != null && !counters.isEmpty()){ + for (final Map.Entry entry : counters.entrySet()) { + final String counterName = entry.getKey(); + final Long counterValue = entry.getValue() / divisor; - final String counterId = processorStatus.getId() + "_" + counterName; - final Long lastValue = lastCounterValues.getOrDefault(counterId, 0L); + final String counterId = processorStatus.getId() + "_" + counterName; + final Long lastValue = lastCounterValues.getOrDefault(counterId, 0L); - lastCounterValues.put(counterId, counterValue); + lastCounterValues.put(counterId, counterValue); - if (showDeltas) { - final String diff = toDiff(lastValue, counterValue); + if (showDeltas) { + final String diff = toDiff(lastValue, counterValue); - builder.append(String.format(COUNTER_LINE_FORMAT, - processorStatus.getName() + "(" + processorStatus.getId() + ")", - counterName, - counterValue + diff)); - } else { - builder.append(String.format(COUNTER_LINE_FORMAT, - processorStatus.getName() + "(" + processorStatus.getId() + ")", - counterName, - counterValue)); + builder.append(String.format(COUNTER_LINE_FORMAT, + processorStatus.getName() + "(" + processorStatus.getId() + ")", + counterName, + counterValue + diff)); + } else { + builder.append(String.format(COUNTER_LINE_FORMAT, + processorStatus.getName() + "(" + processorStatus.getId() + ")", + counterName, + counterValue)); + } } } }