From 0d5e5b2130b0b3e0d3b4b882acf8d141e7dc215d Mon Sep 17 00:00:00 2001 From: Shubhada Ramkrishna Vaze Date: Wed, 9 Jan 2019 12:12:53 +0530 Subject: Sonar Critical: Use Logger and log the exception Fix exception logging issues at multiple locations in same file. Change-Id: I6c18b4a4508d3e6af677ff2f70d668d970c3910f Issue-ID: AAI-2061 Signed-off-by: Shubhada Ramkrishna Vaze Sonar Critical: Use Logger and log the exception Suggested changes are made Change-Id: I0287b409a265ebf8ee3916266b96c396e44df5da Issue-ID: AAI-2061 Signed-off-by: Shubhada Ramkrishna Vaze --- .../src/main/java/org/onap/aai/util/MakeNamedQuery.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/aai-traversal/src/main/java/org/onap/aai/util/MakeNamedQuery.java b/aai-traversal/src/main/java/org/onap/aai/util/MakeNamedQuery.java index a805e19..503cf6c 100644 --- a/aai-traversal/src/main/java/org/onap/aai/util/MakeNamedQuery.java +++ b/aai-traversal/src/main/java/org/onap/aai/util/MakeNamedQuery.java @@ -26,6 +26,8 @@ import java.util.List; import java.util.Map.Entry; import java.util.UUID; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; import org.apache.commons.io.FileUtils; import org.onap.aai.config.SpringContextAware; import org.onap.aai.introspection.Introspector; @@ -38,6 +40,8 @@ import org.onap.aai.setup.SchemaVersions; import org.springframework.context.annotation.AnnotationConfigApplicationContext; public class MakeNamedQuery { + + private static final EELFLogger logger = EELFManager.getInstance().getLogger(MakeNamedQuery.class.getName()); public static void main(String[] args) throws Exception { String _apiVersion = AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP); @@ -184,10 +188,10 @@ public class MakeNamedQuery { nqElementList.add(newNQElement.getUnderlyingObject()); } catch (AAIUnknownObjectException e) { - // TODO Auto-generated catch block + logger.info("AAIUnknownObjectException in MakeNamedQuery.setupNQElements() "+e); e.printStackTrace(); } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block + logger.info("IllegalArgumentException in MakeNamedQuery.setupNQElements() "+e); e.printStackTrace(); } return newNQElement; @@ -210,10 +214,10 @@ public class MakeNamedQuery { } } catch (AAIUnknownObjectException e) { - // TODO Auto-generated catch block + logger.info("AAIUnknownObjectException in MakeNamedQuery.loadNQElement() "+e); e.printStackTrace(); } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block + logger.info("IllegalArgumentException in MakeNamedQuery.loadNQElement() "+e); e.printStackTrace(); } return newNqElement; @@ -242,10 +246,10 @@ public class MakeNamedQuery { newRelationshipData.add(newRelationshipDatum1.getUnderlyingObject()); //newRelationshipData.add(newRelationshipDatum2.getUnderlyingObject()); } catch (AAIUnknownObjectException e) { - // TODO Auto-generated catch block + logger.info("AAIUnknownObjectException in MakeNamedQuery.makeWidgetRelationship() "+e); e.printStackTrace(); } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block + logger.info("IllegalArgumentException in MakeNamedQuery.makeWidgetRelationship() "+e); e.printStackTrace(); } -- cgit 1.2.3-korg