From 9ae155d25701591697dfe8b47d4b4b592807531f 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 b0b034f779..991100ed20 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()); }