Repository: nifi
Updated Branches:
  refs/heads/master 0289ca711 -> 18ad34810


NIFI-5142: Do not allow a connection's destination to be changed to a funnel if 
the source is the same funnel. Also fixed some typos in StandardFunnel. This 
closes #2669


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

Branch: refs/heads/master
Commit: 18ad3481071e5863d77fcbad7d99623fd9717956
Parents: 0289ca7
Author: Mark Payne <marka...@hotmail.com>
Authored: Wed May 2 15:01:15 2018 -0400
Committer: Matt Gilman <matt.c.gil...@gmail.com>
Committed: Wed May 2 15:53:52 2018 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/nifi/controller/StandardFunnel.java   | 6 +++---
 .../java/org/apache/nifi/connectable/StandardConnection.java   | 4 ++++
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/18ad3481/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/StandardFunnel.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/StandardFunnel.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/StandardFunnel.java
index 1d598c8..96008a3 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/StandardFunnel.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/StandardFunnel.java
@@ -190,7 +190,7 @@ public class StandardFunnel implements Funnel {
             writeLock.lock();
             try {
                 if (!outgoingConnections.remove(connection)) {
-                    throw new IllegalStateException("No Connection with ID " + 
connection.getIdentifier() + " is currently registered with this Port");
+                    throw new IllegalStateException("No Connection with ID " + 
connection.getIdentifier() + " is currently registered with this Funnel");
                 }
                 outgoingConnections.add(connection);
             } finally {
@@ -202,7 +202,7 @@ public class StandardFunnel implements Funnel {
             writeLock.lock();
             try {
                 if (!incomingConnections.remove(connection)) {
-                    throw new IllegalStateException("No Connection with ID " + 
connection.getIdentifier() + " is currently registered with this Port");
+                    throw new IllegalStateException("No Connection with ID " + 
connection.getIdentifier() + " is currently registered with this Funnel");
                 }
                 incomingConnections.add(connection);
             } finally {
@@ -218,7 +218,7 @@ public class StandardFunnel implements Funnel {
             if (!requireNonNull(connection).getSource().equals(this)) {
                 final boolean existed = incomingConnections.remove(connection);
                 if (!existed) {
-                    throw new IllegalStateException("The given connection is 
not currently registered for this ProcessorNode");
+                    throw new IllegalStateException("The given connection is 
not currently registered for this Funnel");
                 }
                 return;
             }

http://git-wip-us.apache.org/repos/asf/nifi/blob/18ad3481/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/connectable/StandardConnection.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/connectable/StandardConnection.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/connectable/StandardConnection.java
index 9ded0e0..6172874 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/connectable/StandardConnection.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/connectable/StandardConnection.java
@@ -301,6 +301,10 @@ public final class StandardConnection implements 
Connection {
             throw new IllegalStateException("Cannot change destination of 
Connection because FlowFiles from this Connection are currently held by " + 
previousDestination);
         }
 
+        if (newDestination instanceof Funnel && newDestination.equals(source)) 
{
+            throw new IllegalStateException("Funnels do not support 
self-looping connections.");
+        }
+
         try {
             previousDestination.removeConnection(this);
             this.destination.set(newDestination);

Reply via email to