Better null check
This commit is contained in:
parent
0aa5803632
commit
f736fff687
@ -47,6 +47,9 @@ public class DefaultHttpMessage implements HttpMessage {
|
|||||||
private ChannelBuffer content = ChannelBuffers.EMPTY_BUFFER;
|
private ChannelBuffer content = ChannelBuffers.EMPTY_BUFFER;
|
||||||
|
|
||||||
protected DefaultHttpMessage(final HttpVersion version) {
|
protected DefaultHttpMessage(final HttpVersion version) {
|
||||||
|
if (version == null) {
|
||||||
|
throw new NullPointerException("version");
|
||||||
|
}
|
||||||
this.version = version;
|
this.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,12 @@ public class DefaultHttpRequest extends DefaultHttpMessage implements HttpReques
|
|||||||
|
|
||||||
public DefaultHttpRequest(HttpVersion httpVersion, HttpMethod method, String uri) {
|
public DefaultHttpRequest(HttpVersion httpVersion, HttpMethod method, String uri) {
|
||||||
super(httpVersion);
|
super(httpVersion);
|
||||||
|
if (method == null) {
|
||||||
|
throw new NullPointerException("method");
|
||||||
|
}
|
||||||
|
if (uri == null) {
|
||||||
|
throw new NullPointerException("uri");
|
||||||
|
}
|
||||||
this.method = method;
|
this.method = method;
|
||||||
this.uri = uri;
|
this.uri = uri;
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,9 @@ public class DefaultHttpResponse extends DefaultHttpMessage implements HttpRespo
|
|||||||
|
|
||||||
public DefaultHttpResponse(HttpVersion version, HttpResponseStatus status) {
|
public DefaultHttpResponse(HttpVersion version, HttpResponseStatus status) {
|
||||||
super(version);
|
super(version);
|
||||||
|
if (status == null) {
|
||||||
|
throw new NullPointerException("status");
|
||||||
|
}
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user