Fix some sonar issues in sli/northbound
authorsurya-huawei <a.u.surya@huawei.com>
Mon, 25 Sep 2017 12:01:57 +0000 (17:31 +0530)
committersurya-huawei <a.u.surya@huawei.com>
Mon, 25 Sep 2017 12:10:34 +0000 (17:40 +0530)
*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 <a.u.surya@huawei.com>
ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java

index 0664e82..5d83c5d 100644 (file)
@@ -332,7 +332,7 @@ public class SdncUebCallback implements INotificationCallback {
         deployList = new LinkedList[numPasses];
 
         for (int i = 0 ; i < numPasses ; i++) {
-                       deployList[i] = new LinkedList<DeployableArtifact>();
+                       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<String, String> mappingParams = new HashMap<String, String>();
+                               Map<String, String> 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