bbende commented on code in PR #10815:
URL: https://github.com/apache/nifi/pull/10815#discussion_r2759772256
##########
nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/flow/FlowControllerFlowContextFactory.java:
##########
@@ -98,19 +103,38 @@ private void copyGroupContents(final ProcessGroup
sourceGroup, final ProcessGrou
final VersionedComponentFlowMapper flowMapper = new
VersionedComponentFlowMapper(flowController.getExtensionManager(),
flowMappingOptions);
final InstantiatedVersionedProcessGroup versionedGroup =
flowMapper.mapProcessGroup(sourceGroup,
flowController.getControllerServiceProvider(),
flowController.getFlowManager(), true);
- final VersionedExternalFlow versionedExternalFlow = new
VersionedExternalFlow();
- versionedExternalFlow.setFlowContents(versionedGroup);
- versionedExternalFlow.setExternalControllerServices(Map.of());
- versionedExternalFlow.setParameterProviders(Map.of());
- versionedExternalFlow.setParameterContexts(Map.of());
- destinationGroup.updateFlow(versionedExternalFlow, componentIdSeed,
false, true, true);
+ final String contextName = sourceGroup.getParameterContext().getName();
Review Comment:
Any concern about an NPE here?
Previously line 111 had a check for `if (sourceContext != null) {` before
referencing any field
##########
nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/components/connector/StandardConnectorRepository.java:
##########
@@ -224,22 +224,9 @@ private void waitForState(final ConnectorNode connector,
final Set<ConnectorStat
}
private void cleanUpAssets(final ConnectorNode connector) {
- final FrameworkFlowContext activeFlowContext =
connector.getActiveFlowContext();
- final ConnectorConfiguration activeConfiguration =
activeFlowContext.getConfigurationContext().toConnectorConfiguration();
-
final Set<String> referencedAssetIds = new HashSet<>();
- for (final NamedStepConfiguration namedStepConfiguration :
activeConfiguration.getNamedStepConfigurations()) {
- final StepConfiguration stepConfiguration =
namedStepConfiguration.configuration();
- final Map<String, ConnectorValueReference> stepPropertyValues =
stepConfiguration.getPropertyValues();
- if (stepPropertyValues == null) {
- continue;
- }
- for (final ConnectorValueReference valueReference :
stepPropertyValues.values()) {
- if (valueReference instanceof AssetReference assetReference) {
-
referencedAssetIds.addAll(assetReference.getAssetIdentifiers());
- }
- }
- }
+ collectReferencedAssetIds(connector.getActiveFlowContext(),
referencedAssetIds);
+ collectReferencedAssetIds(connector.getWorkingFlowContext(),
referencedAssetIds);
Review Comment:
Since this is called from `discardWorkingConfiguration` and `applyUpdate` ,
wouldn't the working context always have the same references as the active
context?
--
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]