Repository: nifi
Updated Branches:
  refs/heads/master f47be77b6 -> 36ab8474d


NIFI-1900: Verify that connection's destination is not running when trying to 
change destination

This closes #550


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/36ab8474
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/36ab8474
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/36ab8474

Branch: refs/heads/master
Commit: 36ab8474dd49267ca0db8b176b7b61d9d31c8dc4
Parents: f47be77
Author: Mark Payne <marka...@hotmail.com>
Authored: Mon Jun 20 14:24:33 2016 -0400
Committer: Matt Burgess <mattyb...@apache.org>
Committed: Wed Jun 22 12:39:53 2016 -0400

----------------------------------------------------------------------
 .../org/apache/nifi/web/dao/impl/StandardConnectionDAO.java   | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/36ab8474/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardConnectionDAO.java
----------------------------------------------------------------------
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 8a6bc3e..f5c6f85 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
@@ -409,6 +409,13 @@ public class StandardConnectionDAO extends ComponentDAO 
implements ConnectionDAO
                 throw new ValidationException(validationErrors);
             }
 
+            // 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");
+            }
+
             // verify that this connection supports modification
             connection.verifyCanUpdate();
         }

Reply via email to