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

This closes #550
This commit is contained in:
Mark Payne 2016-06-20 14:24:33 -04:00 committed by Matt Burgess
parent f47be77b6a
commit 36ab8474dd
1 changed files with 7 additions and 0 deletions

View File

@ -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();
}