From 719e468042aa84b17624c7daf7f29b1684768b64 Mon Sep 17 00:00:00 2001 From: Oleksandr Moliavko Date: Thu, 10 Oct 2019 14:05:16 +0300 Subject: Added throw statement for created exception object to prevent static analyzer warning about exception ending up never thrown; removed redundant initializer for serviceFromDB variable Issue-ID: SO-1841 Signed-off-by: Oleksandr Moliavko Change-Id: Ic82acabfc213be3f1132e8525fdac188e6599338 --- .../java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'adapters') diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java index bc4d0064d0..9663033c20 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java @@ -63,7 +63,7 @@ public class ServiceRestImpl { public Service findService(@PathParam("modelUUID") String modelUUID, @QueryParam("depth") int depth) { org.onap.so.db.catalog.beans.Service service = serviceRepo.findOneByModelUUID(modelUUID); if (service == null) { - new CatalogEntityNotFoundException("Unable to find Service " + modelUUID); + throw new CatalogEntityNotFoundException("Unable to find Service " + modelUUID); } return serviceMapper.mapService(service, depth); } @@ -79,7 +79,7 @@ public class ServiceRestImpl { required = false) @QueryParam("distributionStatus") String distributionStatus, @Parameter(description = "depth", required = false) @QueryParam("depth") int depth) { List services = new ArrayList<>(); - List serviceFromDB = new ArrayList<>(); + List serviceFromDB; if (!Strings.isNullOrEmpty(modelName) && !Strings.isNullOrEmpty(distributionStatus)) { serviceFromDB = serviceRepo.findByModelNameAndDistrobutionStatus(modelName, distributionStatus); } else if (!Strings.isNullOrEmpty(modelName)) { -- cgit 1.2.3-korg