aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-healing-lib
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-healing-lib
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-healing-lib')
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentQuestionnaireHealer.java5
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java6
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java5
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java27
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ValidationStructureHealer.java4
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VlmVersionHealer.java3
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspQuestionnaireHealer.java7
7 files changed, 38 insertions, 19 deletions
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentQuestionnaireHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentQuestionnaireHealer.java
index 2e63a8d50a..d061556e4c 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentQuestionnaireHealer.java
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentQuestionnaireHealer.java
@@ -12,8 +12,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity;
@@ -178,8 +176,7 @@ public class ComponentQuestionnaireHealer implements Healer {
JsonObject computeQuestionnaireJsonObject = new JsonObject();
computeQuestionnaireJsonObject.add(VM_SIZING, vmSizing);
- String computeQuestionnaire = computeQuestionnaireJsonObject != null ?
- computeQuestionnaireJsonObject.toString() : null;
+ String computeQuestionnaire = computeQuestionnaireJsonObject.toString();
computeDao.updateQuestionnaireData(computeEntity.getVspId(), computeEntity.getVersion(),
computeEntity.getComponentId(), computeEntity.getId(), computeQuestionnaire);
compute.remove(VM_SIZING);
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java
index 9800d02ba6..e3701743ec 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java
@@ -31,6 +31,8 @@ import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.common.utils.CommonUtil;
import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.healing.interfaces.Healer;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil;
@@ -92,6 +94,8 @@ public class CompositionDataHealer implements Healer {
private static CompositionEntityDataManager compositionEntityDataManager =
CompositionEntityDataManagerFactory.getInstance().createInterface();
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
public CompositionDataHealer() {
}
@@ -288,6 +292,7 @@ public class CompositionDataHealer implements Healer {
serviceModelDao.storeServiceModel(vspId, version,
translatorOutput.getToscaServiceModel());
} catch (Exception e) {
+ log.debug("", e);
return Optional.empty();
}
@@ -304,6 +309,7 @@ public class CompositionDataHealer implements Healer {
OnboardingTypesEnum.ZIP, uploadData.getContentData().array());
return HeatToToscaUtil.loadAndTranslateTemplateData(fileContentHandler);
} catch (Exception e) {
+ log.debug("", e);
return null;
}
}
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java
index 0d484440cf..4a0a5f9d63 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java
@@ -27,6 +27,8 @@ import org.openecomp.sdc.common.utils.CommonUtil;
import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.healing.interfaces.Healer;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDaoFactory;
@@ -51,6 +53,8 @@ public class FileDataStructureHealer implements Healer {
CandidateServiceFactory.getInstance().createInterface();
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
public FileDataStructureHealer() {
}
@@ -104,6 +108,7 @@ public class FileDataStructureHealer implements Healer {
healingResult = getFileDataStructureFromJson(candidateDataEntity.getFilesDataStructure());
}catch (Exception e){
+ log.debug("", e);
return Optional.empty();
}
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java
index 44b6062e89..32cd8cbae3 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java
@@ -12,6 +12,8 @@ import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.common.utils.CommonUtil;
import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.healing.interfaces.Healer;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil;
@@ -34,6 +36,8 @@ public class HeatToToscaTranslationHealer implements Healer {
templateDao = ServiceTemplateDaoFactory.getInstance().createInterface();
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
public HeatToToscaTranslationHealer(){
}
@@ -58,24 +62,25 @@ public class HeatToToscaTranslationHealer implements Healer {
.getContentData().array());
translatorOutput =
HeatToToscaUtil.loadAndTranslateTemplateData(fileContentHandler);
- }catch (Exception e){
+ } catch (Exception e) {
+ log.debug("", e);
return Optional.empty();
}
- if(Objects.isNull(translatorOutput)){
+ if (Objects.isNull(translatorOutput)) {
return Optional.empty();
- }
+ } else {
- if (translatorOutput != null && translatorOutput.getToscaServiceModel() == null) {
- return Optional.empty();
- }
+ if (translatorOutput.getToscaServiceModel() == null) {
+ return Optional.empty();
+ }
//templateDao.deleteAll(vspId, version);
- serviceModelDao.deleteAll(vspId,version);
- serviceModelDao.storeServiceModel(vspId, version,
- translatorOutput.getToscaServiceModel());
- mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+ serviceModelDao.deleteAll(vspId, version);
+ serviceModelDao.storeServiceModel(vspId, version, translatorOutput.getToscaServiceModel());
+ mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
- return translatorOutput;
+ return translatorOutput;
+ }
}
}
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ValidationStructureHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ValidationStructureHealer.java
index f92fbd1730..58ba3b7c35 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ValidationStructureHealer.java
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ValidationStructureHealer.java
@@ -9,6 +9,8 @@ import org.openecomp.sdc.heat.datatypes.manifest.FileData;
import org.openecomp.sdc.heat.datatypes.structure.Artifact;
import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree;
import org.openecomp.sdc.heat.datatypes.structure.ValidationStructureList;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
@@ -34,6 +36,7 @@ public class ValidationStructureHealer implements Healer {
VendorSoftwareProductInfoDaoFactory.getInstance().createInterface();
private static final OrchestrationTemplateDao orchestrationTemplateDao =
OrchestrationTemplateDaoFactory.getInstance().createInterface();
+ private static final Logger logger = LoggerFactory.getLogger(JsonUtil.class);
@Override
public Object heal(Map<String, Object> healingParams) throws Exception {
@@ -51,6 +54,7 @@ public class ValidationStructureHealer implements Healer {
JsonUtil.json2Object(orchestrationTemplate.getValidationData(), OldValidationStructureTree
.class);
} catch (Exception e){
+ logger.debug("",e);
return Optional.empty();
}
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VlmVersionHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VlmVersionHealer.java
index 6a82d8fa49..4accd790ab 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VlmVersionHealer.java
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VlmVersionHealer.java
@@ -11,14 +11,12 @@ import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory;
import org.openecomp.sdc.vendorlicense.types.VersionedVendorLicenseModel;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.versioning.dao.types.Version;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -55,6 +53,7 @@ public class VlmVersionHealer implements Healer {
vendorLicenseModel =
vendorLicenseFacade.getVendorLicenseModel(vspDetails.getVendorId(), null, user);
} catch (Exception e){
+ logger.debug("" + e);
logger.debug("No Vlm was found for Vsp " + vspDetails.getName());
return Optional.empty();
}
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspQuestionnaireHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspQuestionnaireHealer.java
index 78f2997660..0952a4c88f 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspQuestionnaireHealer.java
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspQuestionnaireHealer.java
@@ -23,9 +23,9 @@ package org.openecomp.sdc.healing.healers;
import org.openecomp.core.utilities.json.JsonSchemaDataGenerator;
import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.healing.interfaces.Healer;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity;
@@ -44,6 +44,8 @@ public class VspQuestionnaireHealer implements Healer {
VendorSoftwareProductInfoDaoFactory.getInstance().createInterface();
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
public VspQuestionnaireHealer() {
}
@@ -80,6 +82,7 @@ public class VspQuestionnaireHealer implements Healer {
questionnaireData = new JsonSchemaDataGenerator(generatedSchema).generateData();
vspInfoDao.updateQuestionnaireData(vspId, version, questionnaireData);
}catch(Exception e){
+ log.debug("", e);
return Optional.empty();
}
mdcDataDebugMessage.debugExitMessage(null, null);