You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/09/12 18:53:20 UTC

[GitHub] [nifi] markap14 commented on a diff in pull request #6408: Fix NullPointerException on updating empty ParameterContext property with NiFi Toolkit

markap14 commented on code in PR #6408:
URL: https://github.com/apache/nifi/pull/6408#discussion_r968802703


##########
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:
   This will address the case of a null value getting set to a non-null value.
   But what about the opposite? If you wanted to set a populated value to a null? We'd get a NPE in that case, no?
   Recommend using `Objects.equals` to check equality instead. I.e., `Objects.equals(existingParam.get().getValue(), paramValue)`



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org