From e0a8b479fd01d6d5dcac3df8aa32daaff67eb0c4 Mon Sep 17 00:00:00 2001 From: Bryan Bende Date: Mon, 1 Feb 2021 14:31:19 -0500 Subject: [PATCH] NIFI-8190 Protect against property that references missing controller service --- .../service/StandardControllerServiceNode.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceNode.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceNode.java index e75fb3c5ec..c9b632be63 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceNode.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceNode.java @@ -257,8 +257,14 @@ public class StandardControllerServiceNode extends AbstractComponentNode impleme for (Entry entry : getEffectivePropertyValues().entrySet()) { PropertyDescriptor descriptor = entry.getKey(); if (descriptor.getControllerServiceDefinition() != null && entry.getValue() != null) { - ControllerServiceNode requiredNode = serviceProvider.getControllerServiceNode(entry.getValue()); - requiredServices.add(requiredNode); + // CS property could point to a non-existent CS, so protect against requiredNode being null + final String referenceId = entry.getValue(); + final ControllerServiceNode requiredNode = serviceProvider.getControllerServiceNode(referenceId); + if (requiredNode != null) { + requiredServices.add(requiredNode); + } else { + LOG.warn("Unable to locate referenced controller service with id {}", referenceId); + } } } return new ArrayList<>(requiredServices);