summaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src/main
diff options
context:
space:
mode:
authorArindam Mondal <arind.mondal@samsung.com>2019-09-05 21:35:06 +0900
committerarindamm <arind.mondal@samsung.com>2019-09-10 14:07:19 +0900
commit35ce89dc017ad5285a260a440dcbc26249502c74 (patch)
tree73de6265595742c3707ffe4cca7203468804d007 /adapters/mso-openstack-adapters/src/main
parentf5f7d0763673dd0af81624eaa93b6951e1d299eb (diff)
General sonar fixes
+)Format logger ++) Remove toString() +++) Extract nested IF Issue-ID: SO-2226 Change-Id: Iff28408584b04ffd03b6aca0f647d0af9090a9c2 Signed-off-by: arind.mondal <arind.mondal@samsung.com>
Diffstat (limited to 'adapters/mso-openstack-adapters/src/main')
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java33
2 files changed, 17 insertions, 18 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
index 14d83b3b06..35008b6120 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
@@ -84,7 +84,7 @@ public class AuditVServer extends AbstractAudit {
try {
logger.debug("Vserver to Audit: {}", objectMapper.getMapper().writeValueAsString(vserver));
} catch (JsonProcessingException e) {
- logger.error("Json parse exception: {}", e.getMessage());
+ logger.error("Json parse exception: ", e);
}
});
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
index afc227faf0..013c7f8a84 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
@@ -91,6 +91,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
private static final String CREATE_NETWORK_CONTEXT = "CreateNetwork";
private static final String NEUTRON_MODE = "NEUTRON";
private static final String CLOUD_OWNER = "CloudOwner";
+ private static final String LOG_DEBUG_MSG = "Got Network definition from Catalog: {}";
private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterImpl.class);
@@ -292,7 +293,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
- logger.debug("Got HEAT Template from DB: {}", heatTemplate.toString());
+ logger.debug("Got HEAT Template from DB: {}", heatTemplate);
// "Fix" the template if it has CR/LF (getting this from Oracle)
String template = heatTemplate.getHeatTemplate();
@@ -656,7 +657,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
- logger.debug("Got HEAT Template from DB: {}", heatTemplate.toString());
+ logger.debug("Got HEAT Template from DB: {}", heatTemplate);
// "Fix" the template if it has CR/LF (getting this from Oracle)
String template = heatTemplate.getHeatTemplate();
@@ -798,12 +799,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
}
if (networkCust != null) {
- logger.debug("Got Network Customization definition from Catalog: {}", networkCust.toString());
+ logger.debug("Got Network Customization definition from Catalog: {}", networkCust);
networkResource = networkCust.getNetworkResource();
} else if (collectionNetworkCust != null) {
- logger.debug("Retrieved Collection Network Resource Customization from Catalog: {}",
- collectionNetworkCust.toString());
+ logger.debug("Retrieved Collection Network Resource Customization from Catalog: {}", collectionNetworkCust);
networkResource = collectionNetworkCust.getNetworkResource();
}
if (networkResource == null) {
@@ -814,7 +814,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
- logger.debug("Got Network definition from Catalog: {}", networkResource.toString());
+ logger.debug(LOG_DEBUG_MSG, networkResource);
String mode = networkResource.getOrchestrationMode();
NetworkType neutronNetworkType = NetworkType.valueOf(networkResource.getNeutronNetworkType());
@@ -1045,7 +1045,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
String mode = "";
if (networkResource != null) {
- logger.debug("Got Network definition from Catalog: {}", networkResource.toString());
+ logger.debug(LOG_DEBUG_MSG, networkResource);
mode = networkResource.getOrchestrationMode();
}
@@ -1132,7 +1132,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String mode = "";
if (networkResource != null) {
- logger.debug("Got Network definition from Catalog: {}", networkResource.toString());
+ logger.debug(LOG_DEBUG_MSG, networkResource);
mode = networkResource.getOrchestrationMode();
}
@@ -1388,9 +1388,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Resource Property
List<ContrailSubnet> cslist = new ArrayList<>();
for (Subnet subnet : subnets) {
- logger.debug("Input Subnet:{}", subnet.toString());
+ logger.debug("Input Subnet:{}", subnet);
ContrailSubnet cs = new ContrailSubnetMapper(subnet).map();
- logger.debug("Contrail Subnet:{}", cs.toString());
+ logger.debug("Contrail Subnet:{}", cs);
cslist.add(cs);
}
@@ -1523,18 +1523,17 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
JsonNode rootNode = mapper.readTree(jStr);
if (rootNode != null) {
for (JsonNode sNode : rootNode.path("ipam_subnets")) {
- logger.debug("Output Subnet Node {}", sNode.toString());
+ logger.debug("Output Subnet Node {}", sNode);
String name = sNode.path("subnet_name").textValue();
String uuid = sNode.path("subnet_uuid").textValue();
String aaiId = name; // default
// try to find aaiId for name in input subnetList
if (subnets != null) {
for (Subnet subnet : subnets) {
- if (subnet != null && !commonUtils.isNullOrEmpty(subnet.getSubnetName())) {
- if (subnet.getSubnetName().equals(name)) {
- aaiId = subnet.getSubnetId();
- break;
- }
+ if (subnet != null && !commonUtils.isNullOrEmpty(subnet.getSubnetName())
+ && subnet.getSubnetName().equals(name)) {
+ aaiId = subnet.getSubnetId();
+ break;
}
}
}
@@ -1549,7 +1548,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
ErrorCode.DataError.getValue(), e);
}
- logger.debug("Return sMap {}", sMap.toString());
+ logger.debug("Return sMap {}", sMap);
return sMap;
}