From 9e296830ab813bbdecf65b57ba723ae822abeff5 Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Fri, 7 Jul 2017 15:18:51 -0400 Subject: [PATCH] NIFI-4151: Ensure that we properly call invalidateValidationContext() when properties change; ensure that in the controller service provider we don't replace a controller service with a new node if the ID's match, as we won't be able to actually add the new one to the flow. This closes #1995 --- .../apache/nifi/controller/AbstractConfiguredComponent.java | 6 +++--- .../service/StandardControllerServiceProvider.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractConfiguredComponent.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractConfiguredComponent.java index 2aa84f8b84..45c6eadaac 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractConfiguredComponent.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractConfiguredComponent.java @@ -217,7 +217,7 @@ public abstract class AbstractConfiguredComponent implements ConfigurableCompone } try { - getComponent().onPropertyModified(descriptor, oldValue, value); + onPropertyModified(descriptor, oldValue, value); } catch (final Exception e) { // nothing really to do here... } @@ -253,7 +253,7 @@ public abstract class AbstractConfiguredComponent implements ConfigurableCompone } try { - getComponent().onPropertyModified(descriptor, value, null); + onPropertyModified(descriptor, value, null); } catch (final Exception e) { getLogger().error(e.getMessage(), e); } @@ -436,7 +436,7 @@ public abstract class AbstractConfiguredComponent implements ConfigurableCompone } @Override - public void onPropertyModified(final PropertyDescriptor descriptor, final String oldValue, final String newValue) { + public final void onPropertyModified(final PropertyDescriptor descriptor, final String oldValue, final String newValue) { invalidateValidationContext(); try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(getComponent().getClass(), getComponent().getIdentifier())) { getComponent().onPropertyModified(descriptor, oldValue, newValue); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java index 401111322d..5c4e394c0a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java @@ -162,7 +162,7 @@ public class StandardControllerServiceProvider implements ControllerServiceProvi } } - serviceCache.put(id, serviceNode); + serviceCache.putIfAbsent(id, serviceNode); return serviceNode; } catch (final Throwable t) {