From e5a46e5667e52c8bd8ceb4f322ff4d300223267c Mon Sep 17 00:00:00 2001 From: surya-huawei Date: Mon, 25 Sep 2017 17:31:57 +0530 Subject: Fix some sonar issues in sli/northbound *Replace type specification with diamond operator This is done to reduce the verbosity of generics code *Replace ("") with ('') in String.lastIndexOf() This is more efficient for single character *Remove temp variable which is immediately returned New variable is not necessary as the caller cannot see this Issue-Id: CCSDK-87 Change-Id: I353652de723a624935d819b2bc817b4907af98ed Signed-off-by: surya-huawei --- .../onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java index 0664e828..5d83c5d1 100644 --- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java +++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java @@ -332,7 +332,7 @@ public class SdncUebCallback implements INotificationCallback { deployList = new LinkedList[numPasses]; for (int i = 0 ; i < numPasses ; i++) { - deployList[i] = new LinkedList(); + deployList[i] = new LinkedList<>(); } for (int pass = 0 ; pass < config.getMaxPasses() ; pass++) { @@ -450,7 +450,7 @@ public class SdncUebCallback implements INotificationCallback { } - if (toscaYamlType == true) { + if (toscaYamlType) { processToscaYaml (data, svcName, resourceName, artifact, spoolFile, archiveDir); try { @@ -547,7 +547,8 @@ public class SdncUebCallback implements INotificationCallback { // Ingest Service Data - 1707 Metadata serviceMetadata = sdcCsarHelper.getServiceMetadata(); SdncServiceModel serviceModel = new SdncServiceModel(sdcCsarHelper, serviceMetadata); - serviceModel.setFilename(spoolFile.toString().substring(spoolFile.toString().lastIndexOf("/")+1)); // will be csar file name + serviceModel.setFilename(spoolFile.toString().substring(spoolFile + .toString().lastIndexOf('/')+1)); // will be csar file name serviceModel.setServiceInstanceNamePrefix(SdncBaseModel.extractSubstitutionMappingTypeName(sdcCsarHelper).substring(SdncBaseModel.extractSubstitutionMappingTypeName(sdcCsarHelper).lastIndexOf(".")+1)); try { @@ -678,7 +679,7 @@ public class SdncUebCallback implements INotificationCallback { } // Insert VFC_TO_NETWORK_ROLE_MAPPING data - Map mappingParams = new HashMap(); + Map mappingParams = new HashMap<>(); //String cpNetworkRoleTag = "\"" + sdcCsarHelper.getNodeTemplatePropertyLeafValue(cpNode, SdcPropertyNames.PROPERTY_NAME_NETWORKROLETAG) + "\""; // extract network_role, network_role_tag and virtual_binding from this cpNode SdncBaseModel.addParameter("network_role", SdncBaseModel.extractValue(sdcCsarHelper, cpNode, "network_role"), mappingParams); @@ -963,8 +964,7 @@ public class SdncUebCallback implements INotificationCallback { @Override public long getTimestamp() { - long currentTimeMillis = System.currentTimeMillis(); - return currentTimeMillis; + return System.currentTimeMillis(); } @Override -- cgit 1.2.3-korg