Better null check

This commit is contained in:
Trustin Lee 2009-03-27 09:24:28 +00:00
parent 0aa5803632
commit f736fff687
3 changed files with 12 additions and 0 deletions

View File

@ -47,6 +47,9 @@ public class DefaultHttpMessage implements HttpMessage {
private ChannelBuffer content = ChannelBuffers.EMPTY_BUFFER;
protected DefaultHttpMessage(final HttpVersion version) {
if (version == null) {
throw new NullPointerException("version");
}
this.version = version;
}

View File

@ -37,6 +37,12 @@ public class DefaultHttpRequest extends DefaultHttpMessage implements HttpReques
public DefaultHttpRequest(HttpVersion httpVersion, HttpMethod method, String uri) {
super(httpVersion);
if (method == null) {
throw new NullPointerException("method");
}
if (uri == null) {
throw new NullPointerException("uri");
}
this.method = method;
this.uri = uri;
}

View File

@ -34,6 +34,9 @@ public class DefaultHttpResponse extends DefaultHttpMessage implements HttpRespo
public DefaultHttpResponse(HttpVersion version, HttpResponseStatus status) {
super(version);
if (status == null) {
throw new NullPointerException("status");
}
this.status = status;
}