summaryrefslogtreecommitdiffstats
path: root/ms/neng/src/main
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2018-09-11 21:23:11 +0530
committerSandeep J <sandeejh@in.ibm.com>2018-09-11 21:24:18 +0530
commiteff6a2332f5c1b9bd3e4438ffcf4a6148e48b608 (patch)
treeb8d45ad8e5f4c78995b941cb8831ee3ba284cbf0 /ms/neng/src/main
parentb1843e450c2d799caa69f14f1e123dfb3fa35890 (diff)
fixed major sonar issues in SpringServiceImpl.java
fixed sonar issues as detailed in CCSDK-526 Issue-ID: CCSDK-526 Change-Id: Ie00d7147e5ddfc596e9b5484a7aef4984204bab2 Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
Diffstat (limited to 'ms/neng/src/main')
-rw-r--r--ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceImpl.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceImpl.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceImpl.java
index 79e46575..daf8f574 100644
--- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceImpl.java
+++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceImpl.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* 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
@@ -94,12 +96,12 @@ public class SpringServiceImpl implements SpringService {
@Transactional(rollbackOn = Exception.class)
public NameGenResponse genNetworkElementName(NameGenRequest request) throws Exception {
try {
- Map<String, Map<String, String>> earlierNames = new HashMap<String, Map<String, String>>();
- List<Map<String, String>> allElements = new ArrayList<Map<String, String>>();
- Map<String, Map<String, ?>> policyCache = new HashMap<String, Map<String, ?>>();
- List<Map<String, String>> generatedNames = new ArrayList<Map<String, String>>();
+ Map<String, Map<String, String>> earlierNames = new HashMap<>();
+ List<Map<String, String>> allElements = new ArrayList<>();
+ Map<String, Map<String, ?>> policyCache = new HashMap<>();
+ List<Map<String, String>> generatedNames = new ArrayList<>();
validateRequest(request);
- if (request.getElements() != null && request.getElements().size() > 0) {
+ if (!request.getElements().isEmpty()) {
allElements.addAll(request.getElements());
}
PolicyFinder policyFinderImpl = findPolicyFinderImpl(request);
@@ -194,7 +196,7 @@ public class SpringServiceImpl implements SpringService {
void validateRequest(NameGenRequest request) throws Exception {
List<Map<String, String>> elems = request.getElements();
- if (elems != null && elems.size() > 0) {
+ if (!elems.isEmpty()) {
boolean error = false;
Set<String> externalKeySet = elems.stream().map(s -> s.get("external-key")).collect(Collectors.toSet());
if (externalKeySet.size() != request.getElements().size()) {