aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java2
-rw-r--r--grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java2
-rw-r--r--profiles/http/src/main/java/org/onap/cli/fw/http/utils/OnapCommandHttpUtils.java3
-rw-r--r--validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockRequest.java5
-rw-r--r--validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockResponse.java5
5 files changed, 7 insertions, 10 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java b/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java
index 6850fe3f..d2bc98be 100644
--- a/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java
+++ b/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java
@@ -270,7 +270,7 @@ public class OnapCommandPrint {
array.add(rowO);
}
try {
- return new JsonParser().parse(array.toJSONString()).toString();
+ return JsonParser.parseString(array.toJSONString()).toString();
} catch (Exception e) { // NOSONAR
return array.toJSONString();
}
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 ba9920cb..7b00c16c 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
@@ -277,7 +277,7 @@ public class OpenInterfaceGrpcServer {
public static void setOutputAttr(Builder reply, String printOut){
try {
- reply.putAttrs(OnapCommandConstants.RESULTS, new JsonParser().parse(printOut).toString());
+ reply.putAttrs(OnapCommandConstants.RESULTS, JsonParser.parseString(printOut).toString());
} catch (Exception e) { // NOSONAR
reply.putAttrs(OnapCommandConstants.RESULTS, printOut);
}
diff --git a/profiles/http/src/main/java/org/onap/cli/fw/http/utils/OnapCommandHttpUtils.java b/profiles/http/src/main/java/org/onap/cli/fw/http/utils/OnapCommandHttpUtils.java
index dcc3082d..7780701c 100644
--- a/profiles/http/src/main/java/org/onap/cli/fw/http/utils/OnapCommandHttpUtils.java
+++ b/profiles/http/src/main/java/org/onap/cli/fw/http/utils/OnapCommandHttpUtils.java
@@ -304,10 +304,9 @@ public class OnapCommandHttpUtils {
}
public static String normalizeJson(String json) throws OnapCommandHttpInvalidRequestBody {
- JsonParser jsonParser = new JsonParser();
JsonElement node;
try {
- node = jsonParser.parse(json);
+ node = JsonParser.parseString(json);
normalizeJson(node);
return gson.toJson(node);
} catch (Exception e) { //NOSONAR
diff --git a/validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockRequest.java b/validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockRequest.java
index 7b3e5738..1a70be35 100644
--- a/validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockRequest.java
+++ b/validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockRequest.java
@@ -61,10 +61,9 @@ public class MockRequest {
public void setJson(String json) throws IOException { //NOSONAR
if (!json.isEmpty()) {
try {
- JsonParser parser = new JsonParser();
- this.json = parser.parse(json);
+ this.json = JsonParser.parseString(json);
} catch (Exception e) {
- this.json = new JsonParser().parse("{}");
+ this.json = JsonParser.parseString("{}");
}
}
diff --git a/validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockResponse.java b/validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockResponse.java
index 7f605c33..fedfb02a 100644
--- a/validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockResponse.java
+++ b/validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockResponse.java
@@ -39,10 +39,9 @@ public class MockResponse {
public void setJson(String json) throws IOException { //NOSONAR
if (json != null && !json.isEmpty()) {
try {
- JsonParser parser = new JsonParser();
- this.json = parser.parse(json);
+ this.json = JsonParser.parseString(json);
} catch (Exception e) {
- this.json = new JsonParser().parse("{}");
+ this.json = JsonParser.parseString("{}");
}
}
}