151363 [http] registerServlet throws NPE whereas it should throws IllegalArgumentException
diff --git a/bundles/org.eclipse.equinox.http/src/org/eclipse/equinox/http/HttpListener.java b/bundles/org.eclipse.equinox.http/src/org/eclipse/equinox/http/HttpListener.java
index dea17ef..7cfd520 100644
--- a/bundles/org.eclipse.equinox.http/src/org/eclipse/equinox/http/HttpListener.java
+++ b/bundles/org.eclipse.equinox.http/src/org/eclipse/equinox/http/HttpListener.java
@@ -271,6 +271,8 @@
checkAlias(alias);
//check to see if name is valid
+ if (name == null)
+ throw new IllegalArgumentException(NLS.bind(HttpMsg.HTTP_RESOURCE_NAME_INVALID_EXCEPTION, name));
int length = name.length();
if (length > 1) { //we need to allow "/" and ""
if (name.endsWith("/")) //$NON-NLS-1$
@@ -290,6 +292,8 @@
}
private void checkAlias(String alias) {
+ if (alias == null)
+ throw new IllegalArgumentException(NLS.bind(HttpMsg.HTTP_ALIAS_INVALID_EXCEPTION, alias));
//check to see if the alias is valid
if (!alias.equals("/")) //$NON-NLS-1$
{ //so one can register at "/"
@@ -311,7 +315,7 @@
checkNamespace(alias);
if (servlet == null) {
- throw new NullPointerException(HttpMsg.HTTP_SERVLET_NULL_EXCEPTION);
+ throw new IllegalArgumentException(HttpMsg.HTTP_SERVLET_NULL_EXCEPTION);
}
if (http.servlets.contains(servlet)) {
@@ -407,6 +411,8 @@
}
private void checkNamespace(String uri) throws NamespaceException {
+ if (uri == null)
+ throw new IllegalArgumentException(NLS.bind(HttpMsg.HTTP_ALIAS_INVALID_EXCEPTION, uri));
// If alias already exists in master resource table,
// throw NamespaceException
if (registrations.get(uri) != null) {