nagaboinaramgopal commented on code in PR #14049:
URL: https://github.com/apache/cloudstack/pull/14049#discussion_r3933688549
##########
api/src/main/java/org/apache/cloudstack/api/response/TemplateOVFPropertyResponse.java:
##########
@@ -76,7 +76,7 @@ public boolean equals(Object other) {
@Override
public int hashCode() {
- return key.hashCode();
+ return key == null ? 0 : key.hashCode();
}
Review Comment:
Thanks @DaanHoogland, and fair point, this is a thin one. The reason it is
key-only is that equals() in this class already compares on key alone, so
hashCode() has to stay consistent with that; the only actual defect is that
hashCode() dereferences key without the null check equals() already has, so
hashing an instance with a null key throws NPE. It is a small hardening with no
strong real-world trigger, so I am happy to close this if you would prefer to
leave the class as it is.
--
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]