diff options
author | Sindhuri.A <arcot.sindhuri@huawei.com> | 2019-04-11 18:30:10 +0530 |
---|---|---|
committer | Sindhu A <arcot.sindhuri@huawei.com> | 2019-04-12 05:43:44 +0000 |
commit | eb3ea71f0f733850ded51332d67ca6d11c1d282f (patch) | |
tree | 8da62809c07766544c147d0d18adb9126e3e18f0 /adapters/mso-openstack-adapters/src | |
parent | 27ea7c27fe1a01b4375552a1403c1e0b7a111f0b (diff) |
Code Enhancement (Sonar Fixes)
Sonar Issues Fixes
Issue-ID: SO-1490
Change-Id: I88fba8a0cf7db9397f16001ff9f0968128424c3d
Signed-off-by: Sindhuri.A <arcot.sindhuri@huawei.com>
Diffstat (limited to 'adapters/mso-openstack-adapters/src')
5 files changed, 12 insertions, 16 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAudit.java index 149de0b698..0a186ccb82 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAudit.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAudit.java @@ -2,7 +2,6 @@ package org.onap.so.adapters.audit; import java.io.Serializable; import java.net.URI; -import org.onap.so.client.aai.AAIObjectType; import org.apache.commons.lang3.builder.ToStringBuilder; public class AAIObjectAudit implements Serializable { diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java index d46229ae8e..947c6ddfeb 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java @@ -27,14 +27,11 @@ import java.util.Map; import java.util.Optional; import org.camunda.bpm.client.task.ExternalTask; import org.camunda.bpm.client.task.ExternalTaskService; -import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.audit.beans.AuditInventory; import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @@ -47,7 +44,7 @@ public class AuditCreateStackService extends AbstractAuditService { public HeatStackAudit heatStackAudit; @Autowired - public Environment env; + public Environment environment; protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) { AuditInventory auditInventory = externalTask.getVariable("auditInventory"); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java index aca6e9e268..048e6dbba2 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java @@ -25,12 +25,10 @@ import java.util.Map; import java.util.Optional; import org.camunda.bpm.client.task.ExternalTask; import org.camunda.bpm.client.task.ExternalTaskService; -import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.audit.beans.AuditInventory; import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @@ -44,7 +42,7 @@ public class AuditDeleteStackService extends AbstractAuditService { public HeatStackAudit heatStackAudit; @Autowired - public Environment env; + public Environment environment; protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) { AuditInventory auditInventory = externalTask.getVariable("auditInventory"); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java index 5c0d2d3019..627f6a276c 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java @@ -54,6 +54,8 @@ public class HeatStackAudit { protected static final Logger logger = LoggerFactory.getLogger(HeatStackAudit.class); + private static final String exceptionMsg = "Error finding Path from Self Link"; + @Autowired protected MsoHeatUtils heat; @@ -110,10 +112,10 @@ public class HeatStackAudit { processNestedResourceGroup(cloudRegion, tenantId, vServersWithLInterface, nestedResourceGroupResources); } else - throw new Exception("Error finding Path from Self Link"); + throw new Exception(exceptionMsg); } catch (Exception e) { logger.error("Error Parsing Link to obtain Path", e); - throw new Exception("Error finding Path from Self Link"); + throw new Exception(exceptionMsg); } } } @@ -143,7 +145,7 @@ public class HeatStackAudit { addSubInterfaceToVserver(vServersWithLInterface, subinterfaceStack, subinterfaceResources); } } else - throw new Exception("Error finding Path from Self Link"); + throw new Exception(exceptionMsg); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetHostRoutes.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetHostRoutes.java index 76881bd58b..b1908d9541 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetHostRoutes.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetHostRoutes.java @@ -29,23 +29,23 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class ContrailSubnetHostRoutes { @JsonProperty("network_ipam_refs_data_ipam_subnets_host_routes_route") - private List<ContrailSubnetHostRoute> host_routes = new ArrayList<ContrailSubnetHostRoute>(); + private List<ContrailSubnetHostRoute> hostRoutes = new ArrayList<>(); public ContrailSubnetHostRoutes() {} public List<ContrailSubnetHostRoute> getHost_routes() { - return host_routes; + return hostRoutes; } public void setHost_routes(List<ContrailSubnetHostRoute> host_routes) { - this.host_routes = host_routes; + this.hostRoutes = host_routes; } @Override public String toString() { StringBuilder buf = new StringBuilder(); - if (host_routes != null) { - for (ContrailSubnetHostRoute hr : host_routes) { + if (hostRoutes != null) { + for (ContrailSubnetHostRoute hr : hostRoutes) { buf.append(hr.toString()); } } |