markap14 commented on a change in pull request #3853: NIFI-6822: Ensure that 
when we manage a Map of ID -> Count, that we p…
URL: https://github.com/apache/nifi/pull/3853#discussion_r363411815
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/StandardProcessSession.java
 ##########
 @@ -3406,6 +3396,41 @@ private void checkpoint(final StandardProcessSession 
session, final List<Provena
             this.contentSizeOut += session.contentSizeOut;
         }
 
+        private <K, V> void mergeMaps(final Map<K, V> destination, final 
Map<K, V> toMerge, final BiFunction<? super V, ? super V, ? extends V> merger) {
+            if (toMerge == null) {
 
 Review comment:
   not sure that null check against destination makes sense in the way this is 
being used. If `toMerge` is null, we can simply do nothing, because there is 
nothing to merge. But if the destination is null, we should not return without 
merging the values that are expected to be merged. It makes more sense IMO to 
throw a NPE in such a case. Is also worth noting that currently, all objects 
that could be passed in for `destination` are guaranteed non-null and if that 
were to change, the existing unit tests would 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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to