This is an automated email from the ASF dual-hosted git repository.
pvillard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new a3fb61d NIFI-9668: Adding informative error when setting same value
in 'set-param' CLI command
a3fb61d is described below
commit a3fb61d9e64bf2283f7e7b6e149e90413721dcf8
Author: Joe Gresock <[email protected]>
AuthorDate: Thu Feb 10 05:33:55 2022 -0500
NIFI-9668: Adding informative error when setting same value in 'set-param'
CLI command
Signed-off-by: Pierre Villard <[email protected]>
This closes #5757.
---
.../apache/nifi/toolkit/cli/impl/command/nifi/params/SetParam.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git
a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/nifi/params/SetParam.java
b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/nifi/params/SetParam.java
index c8cd171..3fa50a9 100644
---
a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/nifi/params/SetParam.java
+++
b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/nifi/params/SetParam.java
@@ -88,6 +88,10 @@ public class SetParam extends
AbstractUpdateParamContextCommand<VoidResult> {
throw new IllegalArgumentException("A parameter value is required
when creating a new parameter");
}
+ if (existingParam.isPresent() &&
existingParam.get().getValue().equals(paramValue)) {
+ throw new IllegalArgumentException(String.format("Parameter value
supplied for parameter [%s] is the same as its current value", paramName));
+ }
+
// Construct the objects for the update...
final ParameterDTO parameterDTO = existingParam.isPresent() ?
existingParam.get() : new ParameterDTO();
parameterDTO.setName(paramName);