Added throw statement for created exception object 53/96853/1
authorOleksandr Moliavko <o.moliavko@samsung.com>
Thu, 10 Oct 2019 11:05:16 +0000 (14:05 +0300)
committerOleksandr Moliavko <o.moliavko@samsung.com>
Thu, 10 Oct 2019 11:05:16 +0000 (14:05 +0300)
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 <o.moliavko@samsung.com>
Change-Id: Ic82acabfc213be3f1132e8525fdac188e6599338

adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java

index bc4d006..9663033 100644 (file)
@@ -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<Service> services = new ArrayList<>();
-        List<org.onap.so.db.catalog.beans.Service> serviceFromDB = new ArrayList<>();
+        List<org.onap.so.db.catalog.beans.Service> serviceFromDB;
         if (!Strings.isNullOrEmpty(modelName) && !Strings.isNullOrEmpty(distributionStatus)) {
             serviceFromDB = serviceRepo.findByModelNameAndDistrobutionStatus(modelName, distributionStatus);
         } else if (!Strings.isNullOrEmpty(modelName)) {