diff --git a/common/src/main/java/io/netty/util/AsciiString.java b/common/src/main/java/io/netty/util/AsciiString.java index 34cec92b00..056c55df07 100644 --- a/common/src/main/java/io/netty/util/AsciiString.java +++ b/common/src/main/java/io/netty/util/AsciiString.java @@ -522,6 +522,10 @@ public final class AsciiString implements CharSequence, Comparable * @return {@code true} if the specified string is equal to this string, {@code false} otherwise. */ public boolean contentEqualsIgnoreCase(CharSequence string) { + if (this == string) { + return true; + } + if (string == null || string.length() != length()) { return false; } @@ -1030,6 +1034,10 @@ public final class AsciiString implements CharSequence, Comparable * @return {@code true} if equal, otherwise {@code false} */ public boolean contentEquals(CharSequence a) { + if (this == a) { + return true; + } + if (a == null || a.length() != length()) { return false; }