NIFI-8190 Protect against property that references missing controller service

This commit is contained in:
Bryan Bende 2021-02-01 14:31:19 -05:00 committed by markap14
parent b4e213cb2c
commit e0a8b479fd
1 changed files with 8 additions and 2 deletions

View File

@ -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);