Skip to content

Commit

Permalink
AVRO-4049: Use JDK Arrays equal to test if two UTF8 strings are equal
Browse files Browse the repository at this point in the history
  • Loading branch information
belugabehr committed Sep 22, 2024
1 parent c7b79bf commit ee66842
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lang/java/avro/src/main/java/org/apache/avro/util/Utf8.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ public boolean equals(Object o) {
Utf8 that = (Utf8) o;
if (!(this.length == that.length))
return false;
if (this.length > 7) {
return Arrays.equals(this.bytes, 0, this.length, that.bytes, 0, that.length);
}
byte[] thatBytes = that.bytes;
for (int i = 0; i < this.length; i++)
if (bytes[i] != thatBytes[i])
Expand Down

0 comments on commit ee66842

Please # to comment.