From: Michael Vorburger Date: Mon, 25 Jun 2018 16:40:38 +0000 (+0200) Subject: clean-up to remove un-used three WebApplicationException subclasses X-Git-Tag: release/fluorine~16 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=0962a3cf00387bdc0101732b5e87e82982a34e2b;p=neutron.git clean-up to remove un-used three WebApplicationException subclasses and minor JavaDoc clean up in the two remaining ones The removed null check in NeutronRoutersNorthbound is (now) pointless. Change-Id: If3bfac610b1dc9563651ac8bba3513e58637265f Signed-off-by: Michael Vorburger --- diff --git a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/BadRequestException.java b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/BadRequestException.java index 7e1e03668..b4d302d25 100644 --- a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/BadRequestException.java +++ b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/BadRequestException.java @@ -5,7 +5,6 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.neutron.northbound.api; import javax.ws.rs.WebApplicationException; @@ -13,7 +12,7 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; /** - * Status Code 400 (Bad Request) + * Status Code 400 = Bad Request. * *

* The request could not be understood by the server due to malformed syntax. diff --git a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/InternalServerErrorException.java b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/InternalServerErrorException.java deleted file mode 100644 index 3ca7b9a32..000000000 --- a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/InternalServerErrorException.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.neutron.northbound.api; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -/** - * Status Code 500 (Internal Server Error) - * - *

- * The server encountered an unexpected condition which prevented - * it from fulfilling the request. - * - * - * - */ -public class InternalServerErrorException extends WebApplicationException { - private static final long serialVersionUID = 1L; - - /** - * Constructor for the INTERNAL_SERVER_ERROR custom handler. - * - * @param string Error message to specify further the - * INTERNAL_SERVER_ERROR response - * - */ - public InternalServerErrorException(String string) { - super(Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(string).type(MediaType.TEXT_PLAIN).build()); - } -} diff --git a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronRoutersNorthbound.java b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronRoutersNorthbound.java index 66b68253c..38510aa53 100644 --- a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronRoutersNorthbound.java +++ b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronRoutersNorthbound.java @@ -77,9 +77,6 @@ public final class NeutronRoutersNorthbound // sorting not supported ) { INeutronRouterCRUD routerInterface = getNeutronCRUD(); - if (routerInterface == null) { - throw new ServiceUnavailableException(serviceUnavailable()); - } List allRouters = routerInterface.getAll(); List ans = new ArrayList<>(); for (NeutronRouter router : allRouters) { diff --git a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/ResourceConflictException.java b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/ResourceConflictException.java deleted file mode 100644 index b2af96355..000000000 --- a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/ResourceConflictException.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.neutron.northbound.api; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -/** - * Status Code 409 (Conflict) - * - *

- * The request could not be completed due to a conflict with the - * current state of the resource. This code is only allowed in - * situations where it is expected that the user might be able to - * resolve the conflict and resubmit the request. The response body - * SHOULD include enough information for the user to recognize the - * source of the conflict. Ideally, the response entity would include - * enough information for the user or user agent to fix the problem; - * however, that might not be possible and is not required. - * - * - * - */ -public class ResourceConflictException extends WebApplicationException { - private static final long serialVersionUID = 1L; - - public ResourceConflictException(String string) { - super(Response.status(Response.Status.CONFLICT).entity(string).type(MediaType.TEXT_PLAIN).build()); - } -} diff --git a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/ResourceNotFoundException.java b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/ResourceNotFoundException.java index 5a0754512..770b4be62 100644 --- a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/ResourceNotFoundException.java +++ b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/ResourceNotFoundException.java @@ -5,7 +5,6 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.neutron.northbound.api; import javax.ws.rs.WebApplicationException; @@ -13,7 +12,7 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; /** - * Status Code 404 (Not Found) + * Status Code 404 = Not Found. * *

* The server has not found anything matching the Request-URI. @@ -24,9 +23,6 @@ import javax.ws.rs.core.Response; * This status code is commonly used when the server does not wish to * reveal exactly why the request has been refused, or when no other * response is applicable. - * - * - * */ public class ResourceNotFoundException extends WebApplicationException { private static final long serialVersionUID = 1L; diff --git a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/ServiceUnavailableException.java b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/ServiceUnavailableException.java deleted file mode 100644 index abddc94be..000000000 --- a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/ServiceUnavailableException.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.neutron.northbound.api; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -/** - * Status Code 503 (Service Unavailable Error) - * - *

- * The server is currently unable to handle the request due to a temporary - * overloading or maintenance of the server. - * The implication is that this is a temporary condition which will be alleviated - * after some delay. - * - * - */ -public class ServiceUnavailableException extends WebApplicationException { - private static final long serialVersionUID = 1L; - - /** - * Constructor for the SERVICE_UNAVAILABLE custom handler. - * - * @param string Error message to specify further the - * SERVICE_UNAVAILABLE response - * - */ - public ServiceUnavailableException(String string) { - super(Response.status(Response.Status.SERVICE_UNAVAILABLE).entity(string).type(MediaType.TEXT_PLAIN).build()); - } -} diff --git a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/UnimplementedException.java b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/UnimplementedException.java deleted file mode 100644 index 9a755597c..000000000 --- a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/UnimplementedException.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.neutron.northbound.api; - -import java.net.HttpURLConnection; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -/** - * Status Code 501 (Not Implemented Error) - * - *

- * The function is not implemented. - * - */ -public class UnimplementedException extends WebApplicationException { - private static final long serialVersionUID = 1L; - - /** - * Constructor for the NOT_IMPLEMENTED custom handler. - * - * @param string Error message to specify further the - * SERVICE_UNAVAILABLE response - * - */ - public UnimplementedException(String string) { - super(Response.status(HttpURLConnection.HTTP_NOT_IMPLEMENTED).entity(string).type(MediaType.TEXT_PLAIN) - .build()); - } -}