[#1637] Check for null parameters

This commit is contained in:
Norman Maurer 2013-07-23 06:29:54 +02:00
parent ec370e1d97
commit dbc74fcc97
3 changed files with 12 additions and 0 deletions

View File

@ -66,6 +66,9 @@ public abstract class DefaultHttpMessage extends DefaultHttpObject implements Ht
@Override @Override
public HttpMessage setProtocolVersion(HttpVersion version) { public HttpMessage setProtocolVersion(HttpVersion version) {
if (version == null) {
throw new NullPointerException("version");
}
this.version = version; this.version = version;
return this; return this;
} }

View File

@ -56,12 +56,18 @@ public class DefaultHttpRequest extends DefaultHttpMessage implements HttpReques
@Override @Override
public HttpRequest setMethod(HttpMethod method) { public HttpRequest setMethod(HttpMethod method) {
if (method == null) {
throw new NullPointerException("method");
}
this.method = method; this.method = method;
return this; return this;
} }
@Override @Override
public HttpRequest setUri(String uri) { public HttpRequest setUri(String uri) {
if (uri == null) {
throw new NullPointerException("method");
}
this.uri = uri; this.uri = uri;
return this; return this;
} }

View File

@ -45,6 +45,9 @@ public class DefaultHttpResponse extends DefaultHttpMessage implements HttpRespo
@Override @Override
public HttpResponse setStatus(HttpResponseStatus status) { public HttpResponse setStatus(HttpResponseStatus status) {
if (status == null) {
throw new NullPointerException("status");
}
this.status = status; this.status = status;
return this; return this;
} }