diff options
author | Sudarshan Kumar <sudars19@in.ibm.com> | 2019-06-20 12:59:07 +0530 |
---|---|---|
committer | Sudarshan Kumar <sudars19@in.ibm.com> | 2019-06-20 13:00:04 +0530 |
commit | 7b26f1c1d8aa65036bd3ec395ef26bbe420ce2b4 (patch) | |
tree | 0014ec2cbe929441b755dc7d9983a7b5b4473a63 /champ-lib | |
parent | 5f880af51082e351d1cb97a6397ebfce5b282a0b (diff) |
Sonar Fix : Added logger
Sonar Fix : Added logger
Issue-ID: AAI-2371
Change-Id: I61d43ceb174c848707ab95c84145890d4a707b25
Signed-off-by: Sudarshan Kumar <sudars19@in.ibm.com>
Diffstat (limited to 'champ-lib')
-rw-r--r-- | champ-lib/champ-janus/src/main/java/org/onap/aai/champjanus/graph/impl/GraphSON.java | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/champ-lib/champ-janus/src/main/java/org/onap/aai/champjanus/graph/impl/GraphSON.java b/champ-lib/champ-janus/src/main/java/org/onap/aai/champjanus/graph/impl/GraphSON.java index 20b993c..93744b1 100644 --- a/champ-lib/champ-janus/src/main/java/org/onap/aai/champjanus/graph/impl/GraphSON.java +++ b/champ-lib/champ-janus/src/main/java/org/onap/aai/champjanus/graph/impl/GraphSON.java @@ -4,6 +4,7 @@ * =================================================================== * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. * Copyright © 2017-2018 Amdocs + * Modifications Copyright (C) 2019 IBM * =================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,27 +21,30 @@ */ package org.onap.aai.champjanus.graph.impl; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -// import com.thinkaurelius.titan.graphdb.tinkerpop.TitanIoRegistry; -import org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; + import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper; import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter; +import org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry; import org.onap.aai.champcore.FormatMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; public class GraphSON implements FormatMapper { + private static final Logger LOGGER = LoggerFactory.getLogger(GraphSON.class); private final GraphSONMapper mapper; private final GraphSONWriter writer; protected JsonParser parser; public GraphSON() { - this.mapper = GraphSONMapper.build().addRegistry(JanusGraphIoRegistry.getInstance ()).create(); + this.mapper = GraphSONMapper.build().addRegistry(JanusGraphIoRegistry.getInstance()).create(); this.writer = GraphSONWriter.build().mapper(this.mapper).create(); this.parser = new JsonParser(); } @@ -50,10 +54,10 @@ public class GraphSON implements FormatMapper { String result = ""; try { - this.writer.writeVertex(os, (Vertex)v, Direction.BOTH); + this.writer.writeVertex(os, (Vertex) v, Direction.BOTH); result = os.toString(); } catch (IOException var5) { - var5.printStackTrace(); + LOGGER.debug("Exception occured while formatting object : " + var5.getMessage()); } return this.parser.parse(result).getAsJsonObject(); |