diff options
author | priyanka.akhade <priyanka.akhade@huawei.com> | 2020-03-04 14:21:12 +0000 |
---|---|---|
committer | priyanka.akhade <priyanka.akhade@huawei.com> | 2020-03-04 14:21:12 +0000 |
commit | cf1ab5db1033e403dfc839d5fbbe0580be1d497b (patch) | |
tree | 3396e8fc8e02ae17e457aa9212a1759e51d01641 /grpc/grpc-server | |
parent | 92d3092901ab1866766953e5f8d74bacf27bbc8f (diff) |
Resolved JsonElement issue for grpc server and other classes
Issue-ID: CLI-247
Signed-off-by: priyanka.akhade <priyanka.akhade@huawei.com>
Change-Id: Ifcfba782ec6454f58d1df11e6ab7db3e1a04d17b
Diffstat (limited to 'grpc/grpc-server')
-rw-r--r-- | grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java b/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java index 8b9448b7..93b5beee 100644 --- a/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java +++ b/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java @@ -45,8 +45,7 @@ import org.open.infc.grpc.Result; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; +import com.google.gson.JsonParser; import io.grpc.Server; import io.grpc.ServerBuilder; @@ -55,7 +54,6 @@ import io.grpc.stub.StreamObserver; public class OpenInterfaceGrpcServer { private static final Logger logger = LoggerFactory.getLogger(OpenInterfaceGrpcServer.class.getName()); - private static Gson gson = new GsonBuilder().serializeNulls().create(); private static final String CONF_FILE = "oclip-grpc-server.properties"; private static final String CONF_SERVER_PORT = "oclip.grpc_server_port"; @@ -248,7 +246,7 @@ public class OpenInterfaceGrpcServer { reply.setSuccess(cmd.getResult().isPassed()); try { - reply.putAttrs(OnapCommandConstants.RESULTS, gson.fromJson(printOut,String.class)); + reply.putAttrs(OnapCommandConstants.RESULTS, new JsonParser().parse(printOut).toString()); } catch (Exception e) { // NOSONAR reply.putAttrs(OnapCommandConstants.RESULTS, printOut); } |