aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib
diff options
context:
space:
mode:
authormojahidi <mojahidul.islam@amdocs.com>2018-05-15 12:51:42 +0530
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2018-05-15 08:37:37 +0000
commit9559e131f086f6357987730fc0ad674aeb58f0a2 (patch)
treebc498da349be73bff050418ec8dd2c55291b6ed3 /openecomp-be/lib
parentdf247b4913b82af106e7e293d3f56dd427fb3cdd (diff)
Removed logger.debug(, exception)
Removed logger.debug(, exception) from code Change-Id: I27ace75d9e9a1d89e6e1c681531ea6dff46cb647 Issue-ID: SDC-836 Signed-off-by: mojahidi <mojahidul.islam@amdocs.com>
Diffstat (limited to 'openecomp-be/lib')
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java58
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricher.java57
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java17
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/ManualVspDataCollectionService.java41
4 files changed, 88 insertions, 85 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java
index 190eba16d6..92c590b5df 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java
@@ -1,22 +1,18 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2018 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.core.utilities.json;
@@ -26,34 +22,36 @@ import com.google.gson.JsonIOException;
import com.google.gson.JsonParser;
import com.google.gson.JsonSyntaxException;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
import org.apache.commons.collections4.CollectionUtils;
import org.everit.json.schema.EnumSchema;
import org.everit.json.schema.Schema;
import org.everit.json.schema.ValidationException;
import org.everit.json.schema.loader.SchemaLoader;
import org.json.JSONObject;
+import org.onap.sdc.tosca.datatypes.model.RequirementDefinition;
import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.core.utilities.deserializers.RequirementDefinitionDeserializer;
+
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.onap.sdc.tosca.datatypes.model.RequirementDefinition;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
/**
* The type Json util.
*/
public class JsonUtil {
- private static final Logger logger = LoggerFactory.getLogger(JsonUtil.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(JsonUtil.class);
private static final GsonBuilder gsonBuilder;
private static final Gson gson;
@@ -118,21 +116,11 @@ public class JsonUtil {
*/
public static <T> T json2Object(InputStream is, Class<T> classOfT) {
T type;
- try {
try (Reader br = new BufferedReader(new InputStreamReader(is))) {
type = new Gson().fromJson(br, classOfT);
}
- } catch (JsonIOException | JsonSyntaxException | IOException exception) {
+ catch (JsonIOException | JsonSyntaxException | IOException exception) {
throw new RuntimeException(exception);
- } finally {
- if (is != null) {
- try {
- is.close();
- } catch (IOException ignore) {
- logger.debug("",ignore);
- //do nothing
- }
- }
}
return type;
}
@@ -149,7 +137,7 @@ public class JsonUtil {
try {
return new JsonParser().parse(json).isJsonObject();
} catch (JsonSyntaxException jse) {
- logger.debug("",jse);
+ LOGGER.error("Invalid json, Failed to parse json", jse);
return false;
}
}
@@ -186,7 +174,7 @@ public class JsonUtil {
}
private static List<ValidationException> validateUsingEverit(String json, String jsonSchema) {
- logger.debug(
+ LOGGER.debug(
String.format("validateUsingEverit start, json=%s, jsonSchema=%s", json, jsonSchema));
if (json == null || jsonSchema == null) {
throw new IllegalArgumentException("Input strings json and jsonSchema can not be null");
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricher.java
index 2746ea1296..199d11da98 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricher.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricher.java
@@ -1,25 +1,39 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2018 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.enrichment.impl.external.artifact;
+import static org.openecomp.sdc.tosca.services.ToscaConstants.SERVICE_TEMPLATE_FILTER_PROPERTY_NAME;
+import static org.openecomp.sdc.tosca.services.ToscaConstants.SUBSTITUTE_SERVICE_TEMPLATE_PROPERTY_NAME;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+
+import org.onap.sdc.tosca.datatypes.model.Directive;
+import org.onap.sdc.tosca.datatypes.model.NodeTemplate;
+import org.onap.sdc.tosca.datatypes.model.ServiceTemplate;
import org.openecomp.core.enrichment.types.ArtifactCategory;
import org.openecomp.core.enrichment.types.ComponentMonitoringUploadInfo;
import org.openecomp.core.enrichment.types.MonitoringArtifactInfo;
@@ -37,9 +51,6 @@ import org.openecomp.sdc.enrichment.inter.ExternalArtifactEnricherInterface;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
-import org.onap.sdc.tosca.datatypes.model.Directive;
-import org.onap.sdc.tosca.datatypes.model.NodeTemplate;
-import org.onap.sdc.tosca.datatypes.model.ServiceTemplate;
import org.openecomp.sdc.tosca.services.DataModelUtil;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
@@ -49,21 +60,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
-
-import static org.openecomp.sdc.tosca.services.ToscaConstants.SERVICE_TEMPLATE_FILTER_PROPERTY_NAME;
-import static org.openecomp.sdc.tosca.services.ToscaConstants.SUBSTITUTE_SERVICE_TEMPLATE_PROPERTY_NAME;
-
public class MonitoringMibEnricher implements ExternalArtifactEnricherInterface {
private EnrichedServiceModelDao enrichedServiceModelDao;
@@ -71,7 +67,7 @@ public class MonitoringMibEnricher implements ExternalArtifactEnricherInterface
private ComponentArtifactDao componentArtifactDao;
private static final String COMPONENT_PREFIX = "org.openecomp.resource.vfc.";
- private final Logger LOG = LoggerFactory.getLogger(this.getClass().getName());
+ private final Logger log = LoggerFactory.getLogger(this.getClass().getName());
/**
* Enrich map.
@@ -79,6 +75,7 @@ public class MonitoringMibEnricher implements ExternalArtifactEnricherInterface
* @param enrichmentInfo the enrichmentInfo
* @return the map
*/
+ @Override
public Map<String, List<ErrorMessage>> enrich(EnrichmentInfo enrichmentInfo,
ToscaServiceModel serviceModel) {
@@ -277,7 +274,7 @@ public class MonitoringMibEnricher implements ExternalArtifactEnricherInterface
mibs = FileUtils
.getFileContentMapFromZip(FileUtils.toByteArray(monitoringArtifactInfo.getContent()));
} catch (IOException ioException) {
- LOG.debug("", ioException);
+ log.error("Failed to get file content map from zip ", ioException);
ErrorMessage.ErrorMessageUtil
.addMessage(mibServiceArtifact.getName() + "." + type.name(), errors)
.add(new ErrorMessage(ErrorLevel.ERROR, Messages.INVALID_ZIP_FILE.getErrorMessage()));
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java
index e2db44e7b6..27acaafb5b 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java
@@ -1,5 +1,5 @@
/*
- * Copyright © 2016-2017 European Support Limited
+ * Copyright © 2018 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.
@@ -12,10 +12,15 @@
* 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.
- */
+*/
package org.openecomp.sdc.validation.impl.validators;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.core.validation.ErrorMessageCode;
import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder;
@@ -29,12 +34,6 @@ import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.validation.Validator;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-
-
public class ManifestValidator implements Validator {
private static final Logger LOGGER = LoggerFactory.getLogger(YamlValidator.class);
private static final ErrorMessageCode ERROR_CODE_MNF_1 = new ErrorMessageCode("MNF1");
@@ -58,7 +57,7 @@ public class ManifestValidator implements Validator {
throw new Exception("The manifest file '" + SdcCommon.MANIFEST_NAME + "' has no content");
}
} catch (Exception re) {
- LOGGER.debug("",re);
+ LOGGER.error("Invalid manifest file", re);
globalContext.addMessage(SdcCommon.MANIFEST_NAME, ErrorLevel.ERROR,
ErrorMessagesFormatBuilder
.getErrorWithParameters(ERROR_CODE_MNF_6,
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/ManualVspDataCollectionService.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/ManualVspDataCollectionService.java
index 086aa8252a..7d6edde854 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/ManualVspDataCollectionService.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/ManualVspDataCollectionService.java
@@ -1,5 +1,29 @@
+/*
+ * Copyright © 2018 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.
+*/
+
package org.openecomp.sdc.vendorsoftwareproduct.services;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.openecomp.core.utilities.json.JsonUtil;
@@ -41,14 +65,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.com
import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.image.ImageDetails;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-
public class ManualVspDataCollectionService {
@@ -300,7 +316,8 @@ public class ManualVspDataCollectionService {
computeQuestionnaire = computeDao.getQuestionnaireData(vspId, version, componentId,
computeFlavorId);
} catch (Exception ex) {
- log.debug("", ex);
+ log.warn("Failed to get QuestionnaireData from computeDao," +
+ " initializing computeQuestionnaire to null", ex);
computeQuestionnaire = null;
}
if (Objects.nonNull(computeQuestionnaire)) {
@@ -310,7 +327,8 @@ public class ManualVspDataCollectionService {
try {
compute = JsonUtil.json2Object(computeQuestionnaireData, Compute.class);
} catch (Exception ex) {
- log.debug("", ex);
+ log.warn("Failed to convert json value to compute object," +
+ "initializing compute to null", ex);
compute = null;
}
if (compute != null && Objects.nonNull(compute.getVmSizing())) {
@@ -370,7 +388,8 @@ public class ManualVspDataCollectionService {
imageDetails = JsonUtil.json2Object(imageQuestionnaireDataEntity
.getQuestionnaireData(), ImageDetails.class);
} catch (Exception ex) {
- log.debug("", ex);
+ log.warn("Failed to convert json value to ImageDetails object," +
+ "initializing imageDetails to null", ex);
imageDetails = null;
}
if (Objects.nonNull(imageDetails)