You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by tk...@apache.org on 2016/02/23 03:54:19 UTC

[2/2] nifi git commit: NIFI-1282 This closes #228. Fixed error message when attempting to start a disabled port

NIFI-1282 This closes #228. Fixed error message when attempting to start a disabled port

Fixed error message when attempting to start a disabled port

Signed-off-by: joewitt <jo...@apache.org>


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

Branch: refs/heads/support/nifi-0.5.x
Commit: 2a459fe21c708c8316dd255c3dc7f8254e7940f1
Parents: 8a074c3
Author: Pierre Villard <pi...@gmail.com>
Authored: Tue Feb 16 14:34:40 2016 +0100
Committer: Tony Kurc <tr...@gmail.com>
Committed: Mon Feb 22 21:55:05 2016 -0500

----------------------------------------------------------------------
 .../main/java/org/apache/nifi/controller/AbstractPort.java  | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/2a459fe2/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractPort.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractPort.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractPort.java
index 9f86f08..e234171 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractPort.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractPort.java
@@ -539,8 +539,13 @@ public abstract class AbstractPort implements Port {
     public void verifyCanStart() {
         readLock.lock();
         try {
-            if (scheduledState.get() != ScheduledState.STOPPED) {
-                throw new IllegalStateException(this + " is not stopped");
+            switch (scheduledState.get()) {
+                case DISABLED:
+                    throw new IllegalStateException(this + " cannot be started because it is disabled");
+                case RUNNING:
+                    throw new IllegalStateException(this + " cannot be started because it is already running");
+                case STOPPED:
+                    break;
             }
             verifyNoActiveThreads();