ijuma commented on code in PR #14597:
URL: https://github.com/apache/kafka/pull/14597#discussion_r1367722984


##########
clients/src/main/java/org/apache/kafka/common/security/auth/KafkaPrincipal.java:
##########
@@ -68,9 +73,15 @@ public boolean equals(Object o) {
         if (this == o) return true;
         if (o == null) return false;
         if (getClass() != o.getClass()) return false;
-
         KafkaPrincipal that = (KafkaPrincipal) o;
-        return principalType.equals(that.principalType) && 
name.equals(that.name);
+
+        // hashes are cached, so this goes quicker than the string compare
+        if (this.hashCode() != o.hashCode()) {

Review Comment:
   This is incorrect - hashCode can have collisions.



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to