aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager
diff options
context:
space:
mode:
authormojahidi <mojahidul.islam@amdocs.com>2017-12-28 17:37:41 +0530
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-12-31 08:50:29 +0000
commit0195e726cae3f5267dd3be69e089bbbeb4ad5f09 (patch)
tree154a2818bf1f1c06e94d5dbebec4b7a178de8d18 /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager
parent7a6400cdc81d577cb010f1598bc4c501241b124a (diff)
Fixed sonar issues - ComponentDependencyTracker
Fixed all sonar issues Change-Id: I6a6ab4217964a8071af86e090570f8cb4a8dc122 Issue-ID: SDC-343 Signed-off-by: mojahidi <mojahidul.islam@amdocs.com>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ComponentDependencyTracker.java29
1 files changed, 20 insertions, 9 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ComponentDependencyTracker.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ComponentDependencyTracker.java
index a31558f4f9..39f04d67c6 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ComponentDependencyTracker.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ComponentDependencyTracker.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.sdc.vendorsoftwareproduct.utils;
import java.util.HashMap;
@@ -6,7 +22,7 @@ import java.util.Map;
import java.util.Set;
public class ComponentDependencyTracker {
- Map<String, Set<String>> store = new HashMap<>();
+ private final Map<String, Set<String>> store = new HashMap<>();
/**
* Add dependency.
@@ -17,14 +33,9 @@ public class ComponentDependencyTracker {
public void addDependency(String dependent, String dependsOn) {
if (dependent != null && dependsOn != null && dependent.trim().length() > 0 && dependsOn.trim()
.length() > 0) {
- dependent = dependent.toLowerCase();
- dependsOn = dependsOn.toLowerCase();
- Set<String> dependsOnList = store.get(dependent);
- if (dependsOnList == null) {
- dependsOnList = new HashSet<>();
- store.put(dependent, dependsOnList);
- }
- dependsOnList.add(dependsOn);
+ Set<String> dependsOnList = store
+ .computeIfAbsent(dependent.toLowerCase(), k -> new HashSet<>());
+ dependsOnList.add(dependsOn.toLowerCase());
}
}