Skip to content

Commit

Permalink
NIFI-8190 Protect against property that references missing controller…
Browse files Browse the repository at this point in the history
… service
  • Loading branch information
bbende authored and markap14 committed Feb 1, 2021
1 parent b4e213c commit e0a8b47
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,14 @@ public List<ControllerServiceNode> getRequiredControllerServices() {
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);
Expand Down

0 comments on commit e0a8b47

Please sign in to comment.