aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dt5972@att.com>2018-09-11 20:56:17 +0000
committerGerrit Code Review <gerrit@onap.org>2018-09-11 20:56:17 +0000
commite95c46dd5576bd71e0f7d98e1f203dee1a72855d (patch)
tree04dee71408617b90e3a57b643e1bf3b33d910672
parent43a039f58457a29e843393ef49f86da119fa415e (diff)
parenteff6a2332f5c1b9bd3e4438ffcf4a6148e48b608 (diff)
Merge "fixed major sonar issues in SpringServiceImpl.java"
-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()) {