From eb3ea71f0f733850ded51332d67ca6d11c1d282f Mon Sep 17 00:00:00 2001 From: "Sindhuri.A" Date: Thu, 11 Apr 2019 18:30:10 +0530 Subject: Code Enhancement (Sonar Fixes) Sonar Issues Fixes Issue-ID: SO-1490 Change-Id: I88fba8a0cf7db9397f16001ff9f0968128424c3d Signed-off-by: Sindhuri.A --- .../main/java/org/onap/so/adapters/audit/AAIObjectAudit.java | 1 - .../org/onap/so/adapters/audit/AuditCreateStackService.java | 5 +---- .../org/onap/so/adapters/audit/AuditDeleteStackService.java | 4 +--- .../main/java/org/onap/so/adapters/audit/HeatStackAudit.java | 8 +++++--- .../org/onap/so/adapters/network/ContrailSubnetHostRoutes.java | 10 +++++----- 5 files changed, 12 insertions(+), 16 deletions(-) (limited to 'adapters') 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 host_routes = new ArrayList(); + private List hostRoutes = new ArrayList<>(); public ContrailSubnetHostRoutes() {} public List getHost_routes() { - return host_routes; + return hostRoutes; } public void setHost_routes(List 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()); } } -- cgit 1.2.3-korg