Fix a bug where CookieDecoder sets the default maxAge to -1

.. which should be Long.MIN_VALUE
This commit is contained in:
Trustin Lee 2012-08-20 12:05:47 +09:00
parent b7ac3edf02
commit 7f3f792017
2 changed files with 5 additions and 5 deletions

View File

@ -94,7 +94,7 @@ public final class CookieDecoder {
String commentURL = null; String commentURL = null;
String domain = null; String domain = null;
String path = null; String path = null;
long maxAge = Integer.MIN_VALUE; long maxAge = Long.MIN_VALUE;
List<Integer> ports = new ArrayList<Integer>(2); List<Integer> ports = new ArrayList<Integer>(2);
for (int j = i + 1; j < names.size(); j++, i++) { for (int j = i + 1; j < names.size(); j++, i++) {

View File

@ -203,7 +203,7 @@ public class CookieDecoderTest {
assertNull(c.getCommentUrl()); assertNull(c.getCommentUrl());
assertNull(c.getDomain()); assertNull(c.getDomain());
assertTrue(c.getPorts().isEmpty()); assertTrue(c.getPorts().isEmpty());
assertEquals(-1, c.getMaxAge()); assertEquals(Long.MIN_VALUE, c.getMaxAge());
c = it.next(); c = it.next();
assertEquals(1, c.getVersion()); assertEquals(1, c.getVersion());
@ -214,7 +214,7 @@ public class CookieDecoderTest {
assertNull(c.getCommentUrl()); assertNull(c.getCommentUrl());
assertNull(c.getDomain()); assertNull(c.getDomain());
assertTrue(c.getPorts().isEmpty()); assertTrue(c.getPorts().isEmpty());
assertEquals(-1, c.getMaxAge()); assertEquals(Long.MIN_VALUE, c.getMaxAge());
assertFalse(it.hasNext()); assertFalse(it.hasNext());
} }
@ -239,7 +239,7 @@ public class CookieDecoderTest {
assertNull(c.getCommentUrl()); assertNull(c.getCommentUrl());
assertNull(c.getDomain()); assertNull(c.getDomain());
assertTrue(c.getPorts().isEmpty()); assertTrue(c.getPorts().isEmpty());
assertEquals(-1, c.getMaxAge()); assertEquals(Long.MIN_VALUE, c.getMaxAge());
assertTrue(it.hasNext()); assertTrue(it.hasNext());
c = it.next(); c = it.next();
@ -251,7 +251,7 @@ public class CookieDecoderTest {
assertNull(c.getComment()); assertNull(c.getComment());
assertNull(c.getCommentUrl()); assertNull(c.getCommentUrl());
assertTrue(c.getPorts().isEmpty()); assertTrue(c.getPorts().isEmpty());
assertEquals(-1, c.getMaxAge()); assertEquals(Long.MIN_VALUE, c.getMaxAge());
assertFalse(it.hasNext()); assertFalse(it.hasNext());
} }