Handle logger.debug(, exception) 41/47541/2
authormojahidi <mojahidul.islam@amdocs.com>
Tue, 15 May 2018 06:41:15 +0000 (12:11 +0530)
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>
Tue, 15 May 2018 08:36:01 +0000 (08:36 +0000)
Removed logger.debug(, exception) from code

Change-Id: Iec304267d0f113f7a7efa302bc36a7073995ad3d
Issue-ID: SDC-836
Signed-off-by: mojahidi <mojahidul.islam@amdocs.com>
openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java
openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbImpl.java
openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/BaseToscaEnrichmentTest.java
openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ContrailValidator.java

index 7ea07a6..eaaf604 100644 (file)
@@ -1,9 +1,6 @@
-/*-
- * ============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
  * 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.vendorsoftwareproduct.services.impl.composition;
 
 import org.apache.commons.io.FileUtils;
 import org.mockito.InjectMocks;
 import org.mockito.MockitoAnnotations;
-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.ServiceTemplate;
 import org.onap.sdc.tosca.services.ToscaExtensionYamlUtil;
@@ -39,7 +33,6 @@ import org.testng.annotations.Test;
 
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
@@ -55,9 +48,6 @@ import java.util.Map;
 
 public class CompositionDataExtractorImplTest {
 
-  private static final Logger log = (Logger) LoggerFactory.getLogger
-      (CompositionDataExtractorImplTest.class.getName());
-
   @InjectMocks
   private static CompositionDataExtractorImpl compositionDataExtractor;
 
@@ -112,15 +102,6 @@ public class CompositionDataExtractorImplTest {
             toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
         serviceTemplates.put(ToscaUtil.getServiceTemplateFileName(serviceTemplateFromYaml),
             serviceTemplateFromYaml);
-        try {
-          yamlFile.close();
-        } catch (IOException ignore) {
-          log.debug("", ignore);
-        }
-      } catch (FileNotFoundException exception) {
-        throw exception;
-      } catch (IOException exception) {
-        throw exception;
       }
     }
   }
index 2172e1b..71bc146 100644 (file)
@@ -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.nosqldb.impl.cassandra;
 
@@ -44,7 +40,7 @@ class CassandraNoSqlDbImpl implements NoSqlDb {
     private final String keySpace;
     private final MappingManager mappingManager;
 
-    private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+    private final Logger log = LoggerFactory.getLogger(this.getClass().getName());
 
 
     public CassandraNoSqlDbImpl(Session session) {
@@ -71,7 +67,7 @@ class CassandraNoSqlDbImpl implements NoSqlDb {
                 .append(") values (")
                 .append(CommonMethods.duplicateStringWithDelimiter("?", ',', values.length))
                 .append(")");
-        System.out.println(sb.toString());
+        log.info(sb.toString());
         PreparedStatement prepared = session.prepare(sb.toString());
 
         BoundStatement bound;
@@ -117,7 +113,7 @@ class CassandraNoSqlDbImpl implements NoSqlDb {
                     .collect(Collectors.toSet());
             return versions.stream().collect(Collectors.joining(","));
         } catch (Exception e){
-            log.debug("",e);
+            log.error("Failed to retrieve version", e);
             return "Failed to retrieve version";
         }
     }
index 1ca9e82..ad5ac9a 100644 (file)
@@ -1,28 +1,22 @@
-/*-
- * ============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.tosca;
 
 import org.openecomp.core.utilities.file.FileUtils;
-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.ServiceTemplate;
 import org.onap.sdc.tosca.services.ToscaExtensionYamlUtil;
@@ -34,7 +28,6 @@ import java.io.BufferedInputStream;
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
@@ -53,9 +46,6 @@ public class BaseToscaEnrichmentTest {
 
     protected String outputFilesPath;
 
-    private final static Logger log = (Logger) LoggerFactory.getLogger
-        (BaseToscaEnrichmentTest.class.getName());
-
     public static ToscaServiceModel loadToscaServiceModel(String serviceTemplatesPath,
                                                            String globalServiceTemplatesPath,
                                                            String entryDefinitionServiceTemplate)
@@ -101,15 +91,6 @@ public class BaseToscaEnrichmentTest {
                 ServiceTemplate serviceTemplateFromYaml =
                     toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
                 serviceTemplates.put(ToscaUtil.getServiceTemplateFileName(serviceTemplateFromYaml), serviceTemplateFromYaml);
-                try {
-                    yamlFile.close();
-                } catch (IOException ignore) {
-                    log.debug("",ignore);
-                }
-            } catch (FileNotFoundException exception) {
-                throw exception;
-            } catch (IOException exception) {
-                throw exception;
             }
         }
     }
index 453bb91..c54e0b7 100644 (file)
@@ -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,7 +12,7 @@
  * 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;
 
@@ -54,7 +54,7 @@ public class ContrailValidator implements Validator {
     try {
       manifestContent = ValidationUtil.validateManifest(globalContext);
     } catch (Exception exception) {
-      LOGGER.debug("",exception);
+      LOGGER.error("Failed to validate manifest file", exception);
       return;
     }
     Map<String, FileData.Type> fileTypeMap = ManifestUtil.getFileTypeMap(manifestContent);
@@ -120,7 +120,7 @@ public class ContrailValidator implements Validator {
       heatOrchestrationTemplate =
           new YamlUtil().yamlToObject(fileContent, HeatOrchestrationTemplate.class);
     } catch (Exception ignored) {
-      LOGGER.debug("",ignored);
+      LOGGER.error("Invalid file content : " + fileContent, ignored);
       // the HeatValidator should handle file that is failing to parse
       return Optional.empty();
     }