From 7f3f792017da8728e65d2756225c779f9a1c5e45 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Mon, 20 Aug 2012 12:05:47 +0900 Subject: [PATCH] Fix a bug where CookieDecoder sets the default maxAge to -1 .. which should be Long.MIN_VALUE --- .../java/io/netty/handler/codec/http/CookieDecoder.java | 2 +- .../io/netty/handler/codec/http/CookieDecoderTest.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/CookieDecoder.java b/codec-http/src/main/java/io/netty/handler/codec/http/CookieDecoder.java index 91ff1b2ad8..1810764d9d 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/CookieDecoder.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/CookieDecoder.java @@ -94,7 +94,7 @@ public final class CookieDecoder { String commentURL = null; String domain = null; String path = null; - long maxAge = Integer.MIN_VALUE; + long maxAge = Long.MIN_VALUE; List ports = new ArrayList(2); for (int j = i + 1; j < names.size(); j++, i++) { diff --git a/codec-http/src/test/java/io/netty/handler/codec/http/CookieDecoderTest.java b/codec-http/src/test/java/io/netty/handler/codec/http/CookieDecoderTest.java index 9351c9816b..e565d3e362 100644 --- a/codec-http/src/test/java/io/netty/handler/codec/http/CookieDecoderTest.java +++ b/codec-http/src/test/java/io/netty/handler/codec/http/CookieDecoderTest.java @@ -203,7 +203,7 @@ public class CookieDecoderTest { assertNull(c.getCommentUrl()); assertNull(c.getDomain()); assertTrue(c.getPorts().isEmpty()); - assertEquals(-1, c.getMaxAge()); + assertEquals(Long.MIN_VALUE, c.getMaxAge()); c = it.next(); assertEquals(1, c.getVersion()); @@ -214,7 +214,7 @@ public class CookieDecoderTest { assertNull(c.getCommentUrl()); assertNull(c.getDomain()); assertTrue(c.getPorts().isEmpty()); - assertEquals(-1, c.getMaxAge()); + assertEquals(Long.MIN_VALUE, c.getMaxAge()); assertFalse(it.hasNext()); } @@ -239,7 +239,7 @@ public class CookieDecoderTest { assertNull(c.getCommentUrl()); assertNull(c.getDomain()); assertTrue(c.getPorts().isEmpty()); - assertEquals(-1, c.getMaxAge()); + assertEquals(Long.MIN_VALUE, c.getMaxAge()); assertTrue(it.hasNext()); c = it.next(); @@ -251,7 +251,7 @@ public class CookieDecoderTest { assertNull(c.getComment()); assertNull(c.getCommentUrl()); assertTrue(c.getPorts().isEmpty()); - assertEquals(-1, c.getMaxAge()); + assertEquals(Long.MIN_VALUE, c.getMaxAge()); assertFalse(it.hasNext()); }