From a921fe2d6b2633e51380a44326bfa106aa0affba Mon Sep 17 00:00:00 2001 From: Pierre Villard Date: Tue, 5 May 2026 17:20:05 +0200 Subject: [PATCH] NIFI-15907 - PROPERTY_PARAMETERIZATION_REMOVED showing as local change --- .../nifi/util/FlowDifferenceFilters.java | 6 ++-- .../nifi/util/TestFlowDifferenceFilters.java | 32 +++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/FlowDifferenceFilters.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/FlowDifferenceFilters.java index 14f5898fe609..6b06157f5980 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/FlowDifferenceFilters.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/FlowDifferenceFilters.java @@ -588,7 +588,9 @@ private static T replaceNull(final T value, final T replacement) { * Determines whether a property difference is caused by a statically defined property being removed from the component definition. * When a processor or controller service drops a property (for example, as part of a version upgrade that invokes {@code removeProperty} * during migration), the reconciled component in NiFi should not report a "local change" so long as the component does not support - * dynamic properties. + * dynamic properties. This applies whether the registry-side value was a literal value (yielding {@link DifferenceType#PROPERTY_REMOVED}) + * or a parameter reference (yielding {@link DifferenceType#PROPERTY_PARAMETERIZATION_REMOVED}); both represent the same underlying + * scenario of a property no longer exposed by the component definition. * * @param difference the flow difference under evaluation * @param flowManager the flow manager used to resolve instantiated components @@ -597,7 +599,7 @@ private static T replaceNull(final T value, final T replacement) { */ public static boolean isStaticPropertyRemoved(final FlowDifference difference, final FlowManager flowManager) { final DifferenceType differenceType = difference.getDifferenceType(); - if (differenceType != DifferenceType.PROPERTY_REMOVED) { + if (differenceType != DifferenceType.PROPERTY_REMOVED && differenceType != DifferenceType.PROPERTY_PARAMETERIZATION_REMOVED) { return false; } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/util/TestFlowDifferenceFilters.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/util/TestFlowDifferenceFilters.java index 6c891d35ce23..dfb672b0c05d 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/util/TestFlowDifferenceFilters.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/util/TestFlowDifferenceFilters.java @@ -205,6 +205,17 @@ public void testIsStaticPropertyRemovedFromDefinitionWhenPropertyDropped() { "Property removed in component definition"); assertTrue(FlowDifferenceFilters.isStaticPropertyRemoved(difference, flowManager)); + + final FlowDifference parameterizationRemovedDifference = new StandardFlowDifference( + DifferenceType.PROPERTY_PARAMETERIZATION_REMOVED, + localProcessor, + localProcessor, + propertyName, + "#{SomeParam}", + null, + "Property parameterization removed in component definition"); + + assertTrue(FlowDifferenceFilters.isStaticPropertyRemoved(parameterizationRemovedDifference, flowManager)); } @Test @@ -231,6 +242,17 @@ public void testIsStaticPropertyRemovedFromDefinitionWhenDescriptorStillExists() "Property still defined"); assertFalse(FlowDifferenceFilters.isStaticPropertyRemoved(difference, flowManager)); + + final FlowDifference parameterizationRemovedDifference = new StandardFlowDifference( + DifferenceType.PROPERTY_PARAMETERIZATION_REMOVED, + localProcessor, + localProcessor, + propertyName, + "#{SomeParam}", + null, + "Parameterization removed but property still defined"); + + assertFalse(FlowDifferenceFilters.isStaticPropertyRemoved(parameterizationRemovedDifference, flowManager)); } @Test @@ -255,6 +277,16 @@ public void testIsStaticPropertyRemovedFromDefinitionWhenDynamicSupported() { null, "Dynamic property removed"); assertFalse(FlowDifferenceFilters.isStaticPropertyRemoved(difference, flowManager)); + + final FlowDifference parameterizationRemovedDifference = new StandardFlowDifference( + DifferenceType.PROPERTY_PARAMETERIZATION_REMOVED, + localProcessor, + localProcessor, + propertyName, + "#{SomeParam}", + null, + "Dynamic property parameterization removed"); + assertFalse(FlowDifferenceFilters.isStaticPropertyRemoved(parameterizationRemovedDifference, flowManager)); } @Test