From 1edf9eb94cd98ddc2b971c5a82d0d45fe2a03031 Mon Sep 17 00:00:00 2001 From: Xiaoyan Lin Date: Sun, 10 Jan 2016 14:48:09 -0800 Subject: [PATCH] Fix InternalAttribute.equals Motivation: InternalAttribute doesn't extend Attribute, but its equals only returns true when it compares with an Attribute. So it will return false when comparing with itself. Modifications: Make sure InternalAttribute return false for non InternalAttribute objects. Result: InternalAttribute's equals works correctly. --- .../netty/handler/codec/http/multipart/InternalAttribute.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/InternalAttribute.java b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/InternalAttribute.java index 275b46aeea..06ab2050e8 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/InternalAttribute.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/InternalAttribute.java @@ -79,10 +79,10 @@ final class InternalAttribute extends AbstractReferenceCounted implements Interf @Override public boolean equals(Object o) { - if (!(o instanceof Attribute)) { + if (!(o instanceof InternalAttribute)) { return false; } - Attribute attribute = (Attribute) o; + InternalAttribute attribute = (InternalAttribute) o; return getName().equalsIgnoreCase(attribute.getName()); }