diff options
author | Tomasz Wrobel <tomasz.wrobel@nokia.com> | 2020-02-05 08:11:23 +0100 |
---|---|---|
committer | Tomasz Wrobel <tomasz.wrobel@nokia.com> | 2020-02-05 12:27:08 +0100 |
commit | e5387b14669dd26679634f36f0760ae665c34604 (patch) | |
tree | a02eb94fdcea2ec8461140f7199ed591dc8ebdf1 /mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap | |
parent | e9c0b88ed9b0e9a538ee87f25f3ea4c99f853702 (diff) |
Fix Sonar issue with throw generic exception on apihandlerinfra
Issue-ID: SO-2645
Signed-off-by: Tomasz Wrobel <tomasz.wrobel@nokia.com>
Change-Id: I111ca7c7bef271386bd075e2b948f29d7c2b4516
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap')
5 files changed, 50 insertions, 22 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java index 483ac47235..3104c8415f 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java @@ -32,9 +32,14 @@ import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import com.fasterxml.jackson.core.JsonProcessingException; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.apihandler.filters.ResponseUpdater; import org.onap.so.apihandlerinfra.Action; +import org.onap.so.apihandlerinfra.exceptions.ValidateException; +import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound; +import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException; +import org.onap.so.apihandlerinfra.infra.rest.exception.WorkflowEngineConnectionException; import org.onap.so.apihandlerinfra.infra.rest.handler.NetworkRestHandler; import org.onap.so.db.catalog.beans.Recipe; import org.onap.so.db.request.beans.InfraActiveRequests; @@ -71,14 +76,15 @@ public class Network { public Response deleteNetworkInstance(@PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("networkInstanceId") String networkInstanceId, @Context ContainerRequestContext requestContext) - throws Exception { - InfraActiveRequests currentRequest = null; + throws AAIEntityNotFound, NoRecipeException, JsonProcessingException, WorkflowEngineConnectionException, + ValidateException { + String requestId = networkRestHandler.getRequestId(requestContext); String requestorId = "Unknown"; String source = MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME); String requestURI = requestContext.getUriInfo().getAbsolutePath().toString(); - currentRequest = networkRestHandler.createInfraActiveRequestForDelete(requestId, serviceInstanceId, - networkInstanceId, requestorId, source, requestURI); + InfraActiveRequests currentRequest = networkRestHandler.createInfraActiveRequestForDelete(requestId, + serviceInstanceId, networkInstanceId, requestorId, source, requestURI); ServiceInstancesRequest request = requestBuilder.buildNetworkDeleteRequest(networkInstanceId); networkRestHandler.saveInstanceName(request, currentRequest); networkRestHandler.checkDuplicateRequest(serviceInstanceId, networkInstanceId, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java index 135667d3e4..7aaf470e18 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java @@ -32,9 +32,14 @@ import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import com.fasterxml.jackson.core.JsonProcessingException; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.apihandler.filters.ResponseUpdater; import org.onap.so.apihandlerinfra.Action; +import org.onap.so.apihandlerinfra.exceptions.ValidateException; +import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound; +import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException; +import org.onap.so.apihandlerinfra.infra.rest.exception.WorkflowEngineConnectionException; import org.onap.so.apihandlerinfra.infra.rest.handler.ServiceInstanceRestHandler; import org.onap.so.db.catalog.beans.Recipe; import org.onap.so.db.request.beans.InfraActiveRequests; @@ -70,14 +75,15 @@ public class ServiceInstance { @Transactional public Response deleteServiceInstance(@PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) - throws Exception { - InfraActiveRequests currentRequest = null; + throws AAIEntityNotFound, NoRecipeException, JsonProcessingException, WorkflowEngineConnectionException, + ValidateException { + String requestId = requestHandler.getRequestId(requestContext); String requestorId = "Unknown"; String source = MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME); String requestURI = requestContext.getUriInfo().getAbsolutePath().toString(); - currentRequest = requestHandler.createInfraActiveRequestForDelete(requestId, serviceInstanceId, requestorId, - source, requestURI); + InfraActiveRequests currentRequest = requestHandler.createInfraActiveRequestForDelete(requestId, + serviceInstanceId, requestorId, source, requestURI); ServiceInstancesRequest request = requestBuilder.buildServiceDeleteRequest(serviceInstanceId); requestHandler.saveInstanceName(request, currentRequest); requestHandler.checkDuplicateRequest(serviceInstanceId, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java index 4a86d944cf..ddbced98a4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java @@ -9,9 +9,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,9 +32,14 @@ import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import com.fasterxml.jackson.core.JsonProcessingException; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.apihandler.filters.ResponseUpdater; import org.onap.so.apihandlerinfra.Action; +import org.onap.so.apihandlerinfra.exceptions.ValidateException; +import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound; +import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException; +import org.onap.so.apihandlerinfra.infra.rest.exception.WorkflowEngineConnectionException; import org.onap.so.apihandlerinfra.infra.rest.handler.VFModuleRestHandler; import org.onap.so.db.catalog.beans.Recipe; import org.onap.so.db.request.beans.InfraActiveRequests; @@ -72,15 +77,15 @@ public class VfModules { public Response deleteVfModuleInstance(@PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId, @Context ContainerRequestContext requestContext) - throws Exception { - InfraActiveRequests currentRequest = null; + throws AAIEntityNotFound, NoRecipeException, JsonProcessingException, WorkflowEngineConnectionException, + ValidateException { String requestId = restHandler.getRequestId(requestContext); String requestorId = "Unknown"; String source = MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME); String requestURL = requestContext.getUriInfo().getAbsolutePath().toString(); - currentRequest = restHandler.createInfraActiveRequestForDelete(requestId, vfmoduleInstanceId, serviceInstanceId, - vnfInstanceId, requestorId, source, requestURL); + InfraActiveRequests currentRequest = restHandler.createInfraActiveRequestForDelete(requestId, + vfmoduleInstanceId, serviceInstanceId, vnfInstanceId, requestorId, source, requestURL); ServiceInstancesRequest request = requestBuilder.buildVFModuleDeleteRequest(vnfInstanceId, vfmoduleInstanceId, ModelType.vfModule); restHandler.saveInstanceName(request, currentRequest); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java index edb09083d4..68e6eb5858 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java @@ -32,8 +32,12 @@ import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import com.fasterxml.jackson.core.JsonProcessingException; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.apihandler.filters.ResponseUpdater; +import org.onap.so.apihandlerinfra.exceptions.ValidateException; +import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound; +import org.onap.so.apihandlerinfra.infra.rest.exception.WorkflowEngineConnectionException; import org.onap.so.apihandlerinfra.infra.rest.handler.VnfRestHandler; import org.onap.so.db.catalog.beans.Recipe; import org.onap.so.db.request.beans.InfraActiveRequests; @@ -69,14 +73,15 @@ public class Vnf { @Transactional public Response deleteVnfInstance(@PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, - @Context ContainerRequestContext requestContext) throws Exception { - InfraActiveRequests currentRequest = null; + @Context ContainerRequestContext requestContext) + throws AAIEntityNotFound, JsonProcessingException, WorkflowEngineConnectionException, ValidateException { + String requestId = vnfRestHandler.getRequestId(requestContext); String requestorId = "Unknown"; String source = MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME); String requestURL = requestContext.getUriInfo().getAbsolutePath().toString(); - currentRequest = vnfRestHandler.createInfraActiveRequestForDelete(requestId, serviceInstanceId, vnfInstanceId, - requestorId, source, requestURL); + InfraActiveRequests currentRequest = vnfRestHandler.createInfraActiveRequestForDelete(requestId, + serviceInstanceId, vnfInstanceId, requestorId, source, requestURL); ServiceInstancesRequest request = requestBuilder.buildVnfDeleteRequest(vnfInstanceId); vnfRestHandler.saveInstanceName(request, currentRequest); vnfRestHandler.checkDuplicateRequest(serviceInstanceId, vnfInstanceId, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java index 3154c86046..b842580b3f 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java @@ -32,9 +32,14 @@ import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import com.fasterxml.jackson.core.JsonProcessingException; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.apihandler.filters.ResponseUpdater; import org.onap.so.apihandlerinfra.Action; +import org.onap.so.apihandlerinfra.exceptions.ValidateException; +import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound; +import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException; +import org.onap.so.apihandlerinfra.infra.rest.exception.WorkflowEngineConnectionException; import org.onap.so.apihandlerinfra.infra.rest.handler.VFModuleRestHandler; import org.onap.so.apihandlerinfra.infra.rest.handler.VolumeRestHandler; import org.onap.so.db.catalog.beans.Recipe; @@ -76,14 +81,15 @@ public class Volumes { public Response deleteVfModuleInstance(@PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @PathParam("volumeGroupInstanceId") String volumeGroupId, @Context ContainerRequestContext requestContext) - throws Exception { - InfraActiveRequests currentRequest = null; + throws AAIEntityNotFound, NoRecipeException, JsonProcessingException, WorkflowEngineConnectionException, + ValidateException { + String requestId = volumeRestHandler.getRequestId(requestContext); String requestorId = "Unknown"; String source = MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME); String requestURL = requestContext.getUriInfo().getAbsolutePath().toString(); - currentRequest = volumeRestHandler.createInfraActiveRequestForDelete(requestId, volumeGroupId, - serviceInstanceId, vnfInstanceId, requestorId, source, requestURL); + InfraActiveRequests currentRequest = volumeRestHandler.createInfraActiveRequestForDelete(requestId, + volumeGroupId, serviceInstanceId, vnfInstanceId, requestorId, source, requestURL); ServiceInstancesRequest request = requestBuilder.buildVolumeGroupDeleteRequest(vnfInstanceId, volumeGroupId); volumeRestHandler.saveInstanceName(request, currentRequest); volumeRestHandler.checkDuplicateRequest(serviceInstanceId, vnfInstanceId, volumeGroupId, |