exceptionfactory commented on code in PR #11252:
URL: https://github.com/apache/nifi/pull/11252#discussion_r3242348958
##########
nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/serialization/VersionedFlowSynchronizer.java:
##########
@@ -1083,69 +1080,71 @@ private void inheritConnectors(final FlowController
flowController, final Versio
}
private void inheritControllerServices(final FlowController controller,
final VersionedDataflow dataflow, final AffectedComponentSet
affectedComponentSet) {
- final FlowManager flowManager = controller.getFlowManager();
-
- final Set<ControllerServiceNode> toEnable = new HashSet<>();
- final Set<ControllerServiceNode> toDisable = new HashSet<>();
-
- // We need to add any Controller Services that are not yet part of the
flow. We must then
- // update the Controller Services to match what is proposed. Finally,
we can enable the services.
- // We have to do this in 3 parts because if we just configure the
Controller Service as we add it,
- // we will have a situation where Service A references Service B. And
if Service A is added first,
- // Service B's references won't be updated. To avoid this, we create
them all first, and then configure/update
- // them so that when AbstractComponentNode#setProperty is called, it
properly establishes that reference.
final List<VersionedControllerService> controllerServices =
dataflow.getControllerServices();
- final Map<ControllerServiceNode, Map<String, String>>
controllerServicesAddedAndProperties = new HashMap<>();
- for (final VersionedControllerService versionedControllerService :
controllerServices) {
- final ControllerServiceNode serviceNode =
flowManager.getRootControllerService(versionedControllerService.getInstanceIdentifier());
- if (serviceNode == null) {
- final ControllerServiceNode added =
addRootControllerService(controller, versionedControllerService);
- controllerServicesAddedAndProperties.put(added,
versionedControllerService.getProperties());
+ if (controllerServices != null && !controllerServices.isEmpty()) {
Review Comment:
Have you observed the `controllerServices` return as `null`? If not, I
recommend reverting this check to minimize and clarify the scope of changes to
this particular framework class.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]