NPE check

This commit is contained in:
Trustin Lee 2010-01-08 13:29:39 +00:00
parent d7be7be552
commit 4999fabbcc

View File

@ -488,6 +488,9 @@ public class HttpHeaders {
} }
void removeHeader(final String name) { void removeHeader(final String name) {
if (name == null) {
throw new NullPointerException("name");
}
int h = hash(name); int h = hash(name);
int i = index(h); int i = index(h);
removeHeader0(h, i, name); removeHeader0(h, i, name);
@ -576,6 +579,10 @@ public class HttpHeaders {
} }
String getHeader(final String name) { String getHeader(final String name) {
if (name == null) {
throw new NullPointerException("name");
}
int h = hash(name); int h = hash(name);
int i = index(h); int i = index(h);
Entry e = entries[i]; Entry e = entries[i];
@ -590,6 +597,10 @@ public class HttpHeaders {
} }
List<String> getHeaders(final String name) { List<String> getHeaders(final String name) {
if (name == null) {
throw new NullPointerException("name");
}
LinkedList<String> values = new LinkedList<String>(); LinkedList<String> values = new LinkedList<String>();
int h = hash(name); int h = hash(name);