From e13ff4ae93574b246ca5214d56fdf2c66e418a52 Mon Sep 17 00:00:00 2001 From: James Roper Date: Sun, 3 Jun 2012 01:04:23 +0300 Subject: [PATCH] Fixing #378, when path or domain are null in both this and that, equals and compareTo return false even when the cookies are equal. --- .../org/jboss/netty/handler/codec/http/DefaultCookie.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/http/DefaultCookie.java b/src/main/java/org/jboss/netty/handler/codec/http/DefaultCookie.java index d867b67521..38da9c770e 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/DefaultCookie.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/DefaultCookie.java @@ -249,7 +249,7 @@ public class DefaultCookie implements Cookie { if (getPath() == null && that.getPath() != null) { return false; - } else if (that.getPath() == null) { + } else if (that.getPath() == null && getPath() != null) { return false; } if (!getPath().equals(that.getPath())) { @@ -258,7 +258,7 @@ public class DefaultCookie implements Cookie { if (getDomain() == null && that.getDomain() != null) { return false; - } else if (that.getDomain() == null) { + } else if (that.getDomain() == null && getDomain() != null) { return false; } if (!getDomain().equalsIgnoreCase(that.getDomain())) { @@ -277,7 +277,7 @@ public class DefaultCookie implements Cookie { if (getPath() == null && c.getPath() != null) { return -1; - } else if (c.getPath() == null) { + } else if (c.getPath() == null && getPath() != null) { return 1; } v = getPath().compareTo(c.getPath()); @@ -287,7 +287,7 @@ public class DefaultCookie implements Cookie { if (getDomain() == null && c.getDomain() != null) { return -1; - } else if (c.getDomain() == null) { + } else if (c.getDomain() == null && getDomain() != null) { return 1; } v = getDomain().compareToIgnoreCase(c.getDomain());