nandorsoma commented on code in PR #6408:
URL: https://github.com/apache/nifi/pull/6408#discussion_r968909603
##########
nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/nifi/params/SetParam.java:
##########
@@ -88,7 +88,7 @@ public VoidResult doExecute(final NiFiClient client, final
Properties properties
throw new IllegalArgumentException("A parameter value is required
when creating a new parameter");
}
- if (existingParam.isPresent() &&
existingParam.get().getValue().equals(paramValue)) {
Review Comment:
So I tested it. We can avoid the null pointer exception with your proposal,
but it is not enough to set null to a value. On the ParameterDTO, there is a
valueRemoved flag that we also need to set true. Then the value will be updated
to null on the NiFi side.
Though there is a check that only allows to update a value when the new
value is not null. I don't know that it was a requirement or it is another bug:
https://github.com/apache/nifi/blob/5b1034072b207a844ecbd2e8f0da8bf7981a9d24/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/nifi/params/SetParam.java#L100
To summarize, without my change:
- CLI throws an error when we are trying to create a new Parameter with null
value. On the other hand, through NiFi UI, it is possible.
- CLI silently fails to update the Parameter to null, which is also possible
through NiFi UI.
Do you want me to solve these problems along with the original problem, or
do you want to create a separate ticket for that? I'm happy to do them in this
one, but at least we shouldn't silently fail.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]