aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleksandr Moliavko <o.moliavko@samsung.com>2019-10-10 14:05:16 +0300
committerOleksandr Moliavko <o.moliavko@samsung.com>2019-10-10 14:05:16 +0300
commit719e468042aa84b17624c7daf7f29b1684768b64 (patch)
treeb1acbff156b4f2b1176ce5e37de912c0aff4a33c
parente39c2cbf62f993dbe7843b3eb360c485ef445554 (diff)
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 <o.moliavko@samsung.com> Change-Id: Ic82acabfc213be3f1132e8525fdac188e6599338
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java4
1 files changed, 2 insertions, 2 deletions
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<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)) {