Suppressed unnecessary autoboxing

This commit is contained in:
Trustin Lee 2009-03-13 16:28:20 +00:00
parent dc61906620
commit 611364e47c

View File

@ -22,6 +22,8 @@
package org.jboss.netty.handler.codec.http; package org.jboss.netty.handler.codec.http;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
@ -89,7 +91,7 @@ public class CookieDecoder {
String domain = null; String domain = null;
String path = null; String path = null;
int maxAge = -1; int maxAge = -1;
int[] ports = null; List<Integer> ports = new ArrayList<Integer>(2);
loop: loop:
for (int j = i + 1; j < split.length; j++, i++) { for (int j = i + 1; j < split.length; j++, i++) {
String[] val = split[j].split(EQUALS, 2); String[] val = split[j].split(EQUALS, 2);
@ -136,18 +138,20 @@ public class CookieDecoder {
} }
} }
else if (CookieHeaderNames.MAX_AGE.equalsIgnoreCase(name)) { else if (CookieHeaderNames.MAX_AGE.equalsIgnoreCase(name)) {
maxAge = Integer.valueOf(value); maxAge = Integer.parseInt(value);
} }
else if (CookieHeaderNames.VERSION.equalsIgnoreCase(name)) { else if (CookieHeaderNames.VERSION.equalsIgnoreCase(name)) {
version = Integer.valueOf(value); version = Integer.parseInt(value);
} }
else if (CookieHeaderNames.PORT.equalsIgnoreCase(name)) { else if (CookieHeaderNames.PORT.equalsIgnoreCase(name)) {
value = trimValue(value); value = trimValue(value);
String[] portList = value.split(COMMA); String[] portList = value.split(COMMA);
ports = new int[portList.length]; for (String s1: portList) {
for (int i1 = 0; i1 < portList.length; i1++) { try {
String s1 = portList[i1]; ports.add(Integer.valueOf(s1));
ports[i1] = Integer.valueOf(s1); } catch (NumberFormatException e) {
// Ignore.
}
} }
} else { } else {
break loop; break loop;
@ -165,9 +169,7 @@ public class CookieDecoder {
} }
if (version > 1) { if (version > 1) {
theCookie.setCommentUrl(commentURL); theCookie.setCommentUrl(commentURL);
if (ports != null) {
theCookie.setPorts(ports); theCookie.setPorts(ports);
}
theCookie.setDiscard(discard); theCookie.setDiscard(discard);
} }
} }