mirror of https://github.com/apache/nifi.git
NIFI-8190 Protect against property that references missing controller service
This commit is contained in:
parent
b4e213cb2c
commit
e0a8b479fd
|
@ -257,8 +257,14 @@ public class StandardControllerServiceNode extends AbstractComponentNode impleme
|
||||||
for (Entry<PropertyDescriptor, String> entry : getEffectivePropertyValues().entrySet()) {
|
for (Entry<PropertyDescriptor, String> entry : getEffectivePropertyValues().entrySet()) {
|
||||||
PropertyDescriptor descriptor = entry.getKey();
|
PropertyDescriptor descriptor = entry.getKey();
|
||||||
if (descriptor.getControllerServiceDefinition() != null && entry.getValue() != null) {
|
if (descriptor.getControllerServiceDefinition() != null && entry.getValue() != null) {
|
||||||
ControllerServiceNode requiredNode = serviceProvider.getControllerServiceNode(entry.getValue());
|
// CS property could point to a non-existent CS, so protect against requiredNode being null
|
||||||
requiredServices.add(requiredNode);
|
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);
|
return new ArrayList<>(requiredServices);
|
||||||
|
|
Loading…
Reference in New Issue