exceptionfactory commented on code in PR #6227:
URL: https://github.com/apache/nifi/pull/6227#discussion_r933301917


##########
nifi-registry/nifi-registry-core/nifi-registry-flow-diff/src/main/java/org/apache/nifi/registry/flow/diff/StandardFlowDifference.java:
##########
@@ -89,8 +89,8 @@ public String toString() {
 
     @Override
     public int hashCode() {
-        return 31 + 17 * (componentA == null ? 0 : 
componentA.getIdentifier().hashCode()) +
-            17 * (componentB == null ? 0 : 
componentB.getIdentifier().hashCode()) +
+        return 31 + 17 * (componentA == null ? 0 : 
Objects.hash(componentA.getIdentifier())) +
+            17 * (componentB == null ? 0 : 
Objects.hash(componentB.getIdentifier())) +

Review Comment:
   This method should use Objects.`hashCode(Object o)` instead of 
Objects.`hash(Object... values)`. The `Objects.hash()` method delegates to 
`Arrays.hashCode()`, but all that is necessary is to use `Objects.hashCode()` 
to provide null-safe handling of `identifier`.
   ```suggestion
           return 31 + 17 * (componentA == null ? 0 : 
Objects.hashCode(componentA.getIdentifier())) +
               17 * (componentB == null ? 0 : 
Objects.hashCode(componentB.getIdentifier())) +
   ```



-- 
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]

Reply via email to