aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-tosca-lib/src/main
diff options
context:
space:
mode:
authoravigaffa <avi.gaffa@amdocs.com>2017-12-31 15:07:39 +0200
committervempo <vitaliy.emporopulo@amdocs.com>2018-01-02 09:41:41 +0200
commitda5dfcd1a354807d13849c7f4ead535ccfa722fa (patch)
treeb4ef0b97d4c25a38bf4a7a8aa5d3626d6b820a17 /openecomp-be/lib/openecomp-tosca-lib/src/main
parent25ca73d85757869a6d9cc33861070778503ff153 (diff)
Fixing sonar Exception Handling
Change-Id: I04eb047973a3f5c07dd9dc410cb13af974e8ded1 Issue-ID: SDC-810 Signed-off-by: avigaffa <avi.gaffa@amdocs.com> Signed-off-by: vempo <vitaliy.emporopulo@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib/src/main')
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java42
1 files changed, 16 insertions, 26 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java
index 30e767beeb..08fb19399e 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java
@@ -1,27 +1,24 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * 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.
- * ============LICENSE_END=========================================================
*/
package org.openecomp.sdc.tosca.services.impl;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.lang3.StringUtils;
import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
@@ -68,12 +65,12 @@ import java.util.Set;
public class ToscaAnalyzerServiceImpl implements ToscaAnalyzerService {
- protected static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ protected static final MdcDataDebugMessage MDC_DATA_DEBUG_MESSAGE = new MdcDataDebugMessage();
public List<Map<String, RequirementDefinition>> calculateExposedRequirements(
List<Map<String, RequirementDefinition>> nodeTypeRequirementsDefinitionList,
Map<String, RequirementAssignment> nodeTemplateRequirementsAssignment) {
- mdcDataDebugMessage.debugEntryMessage(null, null);
+ MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(null, null);
if (nodeTypeRequirementsDefinitionList == null) {
return null;
@@ -109,7 +106,7 @@ public class ToscaAnalyzerServiceImpl implements ToscaAnalyzerService {
}
}
- mdcDataDebugMessage.debugExitMessage(null, null);
+ MDC_DATA_DEBUG_MESSAGE.debugExitMessage(null, null);
return nodeTypeRequirementsDefinitionList;
}
@@ -136,7 +133,7 @@ public class ToscaAnalyzerServiceImpl implements ToscaAnalyzerService {
Map<String, Map<String, RequirementAssignment>> fullFilledRequirementsDefinitionMap) {
- mdcDataDebugMessage.debugEntryMessage(null, null);
+ MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(null, null);
String capabilityKey;
String capability;
@@ -169,7 +166,7 @@ public class ToscaAnalyzerServiceImpl implements ToscaAnalyzerService {
exposedCapabilitiesDefinition.put(entry.getKey(), entry.getValue());
}
- mdcDataDebugMessage.debugExitMessage(null, null);
+ MDC_DATA_DEBUG_MESSAGE.debugExitMessage(null, null);
return exposedCapabilitiesDefinition;
}
@@ -425,8 +422,7 @@ public class ToscaAnalyzerServiceImpl implements ToscaAnalyzerService {
"Entity[" + elementType + "] id[" + typeId + "] flat not supported");
}
- scanAnFlatEntity(elementType, typeId, returnEntity, serviceTemplate, toscaModel,
- new ArrayList<String>(), 0);
+ scanAnFlatEntity(elementType, typeId, returnEntity, serviceTemplate, toscaModel, new ArrayList<>(), 0);
return returnEntity;
@@ -512,12 +508,6 @@ public class ToscaAnalyzerServiceImpl implements ToscaAnalyzerService {
return Optional.of(false);
}
- private Set<String> addImportFileToAnalyzedImportFilesSet(Set<String> analyzedImportFiles,
- String importFile) {
- analyzedImportFiles.add(importFile);
- return analyzedImportFiles;
- }
-
private Set<String> createFilesScannedSet(Set<String> filesScanned) {
if (Objects.isNull(filesScanned)) {
filesScanned = new HashSet<>();
@@ -568,7 +558,7 @@ public class ToscaAnalyzerServiceImpl implements ToscaAnalyzerService {
if (found) {
return true;
}
- String filename = "";
+ String filename;
for (Object importObject : importMap.values()) {
Import importServiceTemplate = toscaExtensionYamlUtil
.yamlToObject(toscaExtensionYamlUtil.objectToYaml(importObject), Import.class);
@@ -694,13 +684,13 @@ public class ToscaAnalyzerServiceImpl implements ToscaAnalyzerService {
.mergeLists(targetCapabilityType.getValid_source_types(),
sourceCapabilityType.getValid_source_types()));
- if (!CommonMethods.isEmpty(sourceCapabilityType.getDerived_from())) {
+ if (StringUtils.isNotEmpty(sourceCapabilityType.getDerived_from())) {
targetCapabilityType.setDerived_from(sourceCapabilityType.getDerived_from());
}
- if (!CommonMethods.isEmpty(sourceCapabilityType.getDescription())) {
+ if (StringUtils.isNotEmpty(sourceCapabilityType.getDescription())) {
targetCapabilityType.setDescription(sourceCapabilityType.getDescription());
}
- if (!CommonMethods.isEmpty(sourceCapabilityType.getVersion())) {
+ if (StringUtils.isNotEmpty(sourceCapabilityType.getVersion())) {
targetCapabilityType.setVersion(sourceCapabilityType.getVersion());
}