This is an automated email from the ASF dual-hosted git repository.
markap14 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new e0a8b47 NIFI-8190 Protect against property that references missing
controller service
e0a8b47 is described below
commit e0a8b479fd01d6d5dcac3df8aa32daaff67eb0c4
Author: Bryan Bende <[email protected]>
AuthorDate: Mon Feb 1 14:31:19 2021 -0500
NIFI-8190 Protect against property that references missing controller
service
---
.../nifi/controller/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 e75fb3c..c9b632b 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<PropertyDescriptor, String> 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);