diff options
author | Kanagaraj Manickam <kanagaraj.manickam@huawei.com> | 2020-08-06 03:27:35 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-08-06 03:27:35 +0000 |
commit | 29e3d400b200b0567caa6c5768d51ebc2ce2a891 (patch) | |
tree | 898d66b059c384909a2bda622e45d1036cca45d6 /grpc/grpc-server/src | |
parent | 85d106fbd8da63243157c4d79b45c13c9c2d7a2f (diff) | |
parent | 2bdd4f82bb6d2d7928044228bf0893cf6aa5921d (diff) |
Merge "Code improvement - Pending sonar issues"
Diffstat (limited to 'grpc/grpc-server/src')
-rw-r--r-- | grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java | 14 |
1 files changed, 9 insertions, 5 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 c2a61320..ba9920cb 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 @@ -242,11 +242,7 @@ public class OpenInterfaceGrpcServer { // use the status from the plugin. reply.setSuccess(cmd.getResult().isPassed()); - try { - reply.putAttrs(OnapCommandConstants.RESULTS, new JsonParser().parse(printOut).toString()); - } catch (Exception e) { // NOSONAR - reply.putAttrs(OnapCommandConstants.RESULTS, printOut); - } + setOutputAttr(reply, printOut); output = reply.build(); logger.info("{}", output); @@ -279,6 +275,14 @@ public class OpenInterfaceGrpcServer { responseObserver.onCompleted(); } + public static void setOutputAttr(Builder reply, String printOut){ + try { + reply.putAttrs(OnapCommandConstants.RESULTS, new JsonParser().parse(printOut).toString()); + } catch (Exception e) { // NOSONAR + reply.putAttrs(OnapCommandConstants.RESULTS, printOut); + } + } + @Override public void remoteCli(Args req, StreamObserver<Result> responseObserver) { logger.info("{}", req); |