summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-heat-lib/src/main
diff options
context:
space:
mode:
authorDivesh Mirchandani <Divesh.Mirchandani@amdocs.com>2017-09-14 19:14:21 +0530
committerDivesh Mirchandani <Divesh.Mirchandani@amdocs.com>2017-09-18 17:26:38 +0530
commit396cb378ab8940b1adb8ba1adc656d0b4ad66f99 (patch)
treeb4f6ddc8e7cdfe39bfcbdc75cff7e85c284c5b65 /openecomp-be/lib/openecomp-heat-lib/src/main
parent27f5c2b105676eebb477714fd7323467151965d2 (diff)
Fixed SONAR issues
Fixed blocker, critical, major & minor SONAR issues. Issue-ID: SDC-343 Change-Id: I72e5a3a7fa7d7407a92f98f77e4334827f70f926 Signed-off-by: dd4616 <Divesh.Mirchandani@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-heat-lib/src/main')
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java5
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java2
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java12
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java2
4 files changed, 16 insertions, 5 deletions
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java
index 249dcaf4a5..f0bb253a4b 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java
@@ -24,6 +24,8 @@ import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
import org.openecomp.sdc.heat.services.ErrorCodes;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import java.util.HashSet;
import java.util.Set;
@@ -33,6 +35,8 @@ public class HeatBoolean {
private static Set<Object> heatFalse;
private static Set<Object> heatTrue;
+ private final static Logger log = (Logger) LoggerFactory.getLogger(HeatBoolean.class.getName());
+
static {
@@ -90,6 +94,7 @@ public class HeatBoolean {
Boolean answer = eval(value);
return true;
} catch (CoreException ce) {
+ log.debug("",ce);
return false;
}
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java
index dd487603e1..81bf2fa5a9 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java
@@ -31,7 +31,7 @@ import java.util.function.Predicate;
public class FileData {
- public static Set<Type> heatFileTypes =
+ protected static final Set<Type> heatFileTypes =
new HashSet<>(Arrays.asList(Type.HEAT, Type.HEAT_NET, Type.HEAT_VOL));
private Boolean isBase;
private String file;
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java
index def773d712..372c09cffe 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java
@@ -23,7 +23,6 @@ package org.openecomp.sdc.heat.services.tree;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.core.utilities.json.JsonUtil;
-import org.openecomp.sdc.tosca.services.YamlUtil;
import org.openecomp.core.validation.types.GlobalValidationContext;
import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
@@ -34,6 +33,7 @@ import org.openecomp.sdc.heat.datatypes.structure.Artifact;
import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
+import org.openecomp.sdc.tosca.services.YamlUtil;
import java.io.InputStream;
import java.util.HashMap;
@@ -101,10 +101,14 @@ public class HeatTreeManager {
.values().stream().filter(heatStructureTree -> tree.getHeat().contains(heatStructureTree))
.forEach(heatStructureTree -> tree.getHeat().remove(heatStructureTree));
- heatContentMap.getFileList().stream().filter(fileName -> !manifestFiles.contains(fileName))
+ heatContentMap.getFileList().stream().filter(fileName -> isNotInManifestFiles(fileName))
.forEach(fileName -> addTreeOther(fileName));
}
+ private boolean isNotInManifestFiles(String fileName) {
+ return !manifestFiles.contains(fileName);
+ }
+
private void addTreeOther(String fileName) {
if (tree.getOther() == null) {
tree.setOther(new HashSet<>());
@@ -132,7 +136,9 @@ public class HeatTreeManager {
Set<String> artifactSet = HeatTreeManagerUtil.getArtifactFiles(filename, hot, globalContext);
addHeatArtifactFiles(fileHeatStructureTree, artifactSet);
- } catch (Exception ignore) { /* invalid yaml no need to process reference */ }
+ } catch (Exception ignore) { /* invalid yaml no need to process reference */
+ logger.debug("",ignore);
+ }
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java
index b8df50b87c..3802018c99 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java
@@ -166,7 +166,7 @@ public class HeatTreeManagerUtil {
Map<String, Object> resourceDefValueMap = resource.getProperties() == null ? null
: (Map<String, Object>) resource.getProperties().get(
PropertiesMapKeyTypes.RESOURCE_DEF.getKeyMap());
- if (MapUtils.isNotEmpty(resourceDefValueMap)) {
+ if (MapUtils.isNotEmpty(resourceDefValueMap) && resourceDefValueMap != null) {
Object resourceDefType = resourceDefValueMap.get("type");
if (Objects.nonNull(resourceDefType)) {
if (resourceDefType instanceof String) {