From 4d4c525d9c74e81a50d582bd6b7f7045f1d322a6 Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Fri, 15 Jul 2016 15:49:46 -0400 Subject: [PATCH] NIFI-2281: Allow connections to be moved away from running local input ports and funnels This closes #662 Signed-off-by: jpercivall --- .../org/apache/nifi/web/dao/impl/StandardConnectionDAO.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardConnectionDAO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardConnectionDAO.java index 0aff212a12..1ec171d206 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardConnectionDAO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardConnectionDAO.java @@ -59,6 +59,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -419,8 +420,9 @@ public class StandardConnectionDAO extends ComponentDAO implements ConnectionDAO // If destination is changing, ensure that current destination is not running. This check is done here, rather than // in the Connection object itself because the Connection object itself does not know which updates are to occur and // we don't want to prevent updating things like the connection name or backpressure just because the destination is running - if (connectionDTO.getDestination() != null && connection.getDestination().isRunning()) { - throw new IllegalStateException("Cannot change the destination of connection because the current destination is running"); + final Connectable destination = connection.getDestination(); + if (destination != null && destination.isRunning() && destination.getConnectableType() != ConnectableType.FUNNEL && destination.getConnectableType() != ConnectableType.INPUT_PORT) { + throw new ValidationException(Collections.singletonList("Cannot change the destination of connection because the current destination is running")); } // verify that this connection supports modification