Added error logger in exception scenario 28/75928/2
authorChandan Ghosh <cghosh12@in.ibm.com>
Thu, 17 Jan 2019 10:53:21 +0000 (16:23 +0530)
committerChandan Ghosh <cghosh12@in.ibm.com>
Mon, 21 Jan 2019 10:45:50 +0000 (16:15 +0530)
Added error logger in exception scenatio

Issue-ID: AAI-2086
Change-Id: I47b222096ff9613821101e6f87c0bd75d2bf3f4e
Signed-off-by: Chandan Ghosh <cghosh12@in.ibm.com>
src/main/java/org/onap/aai/spike/schema/RelationshipSchema.java

index 6858783..7cddcb5 100644 (file)
@@ -1,5 +1,4 @@
 /**
- * ============LICENSE_START=======================================================
  * Gizmo
  * ================================================================================
  * Copyright © 2017 AT&T Intellectual Property.
@@ -33,19 +32,23 @@ import java.util.stream.Collectors;
 import com.google.common.collect.Multimap;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
+import org.onap.aai.cl.eelf.LoggerFactory;
 import org.codehaus.jackson.map.ObjectMapper;
 import org.onap.aai.edges.EdgeRule;
 import org.onap.aai.spike.exception.SpikeException;
+import org.onap.aai.spike.logging.SpikeMsgs;
 
 
 public class RelationshipSchema {
-    private static final Gson gson = new GsonBuilder().create();
+       
 
     public static final String SCHEMA_SOURCE_NODE_TYPE = "from";
     public static final String SCHEMA_TARGET_NODE_TYPE = "to";
     public static final String SCHEMA_RELATIONSHIP_TYPE = "label";
     public static final String SCHEMA_RULES_ARRAY = "rules";
 
+    private static org.onap.aai.cl.api.Logger logger =
+            LoggerFactory.getInstance().getLogger(RelationshipSchema.class.getName());
 
     private Map<String, Map<String, Class<?>>> relations = new HashMap<>();
     /**
@@ -61,7 +64,7 @@ public class RelationshipSchema {
                     try {
                         return resolveClass(p.getValue());
                     } catch (SpikeException | ClassNotFoundException e) {
-                        e.printStackTrace();
+                       logger.error(SpikeMsgs.OXM_LOAD_ERROR, "Error in RelationshipSchema: " + e);
                     }
                     return null;
                 }));
@@ -85,7 +88,7 @@ public class RelationshipSchema {
                     try {
                         return resolveClass(p.getValue());
                     } catch (SpikeException | ClassNotFoundException e) {
-                        e.printStackTrace();
+                       logger.error(SpikeMsgs.OXM_LOAD_ERROR, "Error in RelationshipSchema: " + e);
                     }
                     return null;
                 }));