mirror of
https://gitee.com/BDWare/cm
synced 2025-01-10 09:54:03 +00:00
feat: update usage of JsonUtil
This commit is contained in:
parent
70c8313226
commit
2701f7286d
@ -1293,7 +1293,7 @@ public class ContractManager {
|
||||
if (client.contractMeta.sigRequired) {
|
||||
if (!request.verifySignature()) {
|
||||
cr = new ContractResult(Status.Error, new JsonPrimitive("sign verified failed"));
|
||||
rcb.onResult(JsonUtil.parseObject(cr));
|
||||
rcb.onResult(JsonUtil.parseObjectAsJsonObject(cr));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1309,7 +1309,7 @@ public class ContractManager {
|
||||
client.traffic += result.length();
|
||||
client.contractStatus = ContractStatus.Executed;
|
||||
|
||||
JsonObject finalRet = JsonUtil.parseString(result);
|
||||
JsonObject finalRet = JsonUtil.parseStringAsJsonObject(result);
|
||||
if (client.getContractCopies() == 1) {
|
||||
finalRet =
|
||||
extractEventsFromContractResult(
|
||||
@ -1368,7 +1368,7 @@ public class ContractManager {
|
||||
client.traffic += result.length();
|
||||
|
||||
if (client.getContractCopies() == 1) {
|
||||
extractEventsFromContractResult(ocb, JsonUtil.parseString(result), client, request, start);
|
||||
extractEventsFromContractResult(ocb, JsonUtil.parseStringAsJsonObject(result), client, request, start);
|
||||
}
|
||||
chainOpener.writeContractResultToLocalAndLedger(
|
||||
result, client, request, ocb, start, System.currentTimeMillis() - start);
|
||||
@ -1552,7 +1552,7 @@ public class ContractManager {
|
||||
new JsonPrimitive(
|
||||
"Contract " + cr.getContractID() + " doesn't exists!!"));
|
||||
}
|
||||
rcb.onResult(JsonUtil.parseObject(result));
|
||||
rcb.onResult(JsonUtil.parseObjectAsJsonObject(result));
|
||||
}
|
||||
|
||||
|
||||
@ -2170,7 +2170,7 @@ public class ContractManager {
|
||||
if (null != client) {
|
||||
try {
|
||||
String ret = client.get.syncGet("", "suicide", "");
|
||||
JsonObject jo = JsonUtil.parseString(ret);
|
||||
JsonObject jo = JsonUtil.parseStringAsJsonObject(ret);
|
||||
if (jo.has("cleanSub")) {
|
||||
REvent msg =
|
||||
new REvent(
|
||||
|
@ -265,7 +265,7 @@ public class EventBroker {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
JsonObject json = JsonUtil.parseString(content);
|
||||
JsonObject json = JsonUtil.parseStringAsJsonObject(content);
|
||||
String subscriber = json.get("subscriber").getAsString();
|
||||
String handler = json.has("handler") ? json.get("handler").getAsString() : null;
|
||||
if (null == subscriber || subscriber.isEmpty()) {
|
||||
|
@ -92,7 +92,7 @@ public class EventRecorder {
|
||||
try {
|
||||
if (json.startsWith("cp")) {
|
||||
// create check point by the transaction and stop retrieving
|
||||
JsonObject data = JsonUtil.parseString(json.substring(2));
|
||||
JsonObject data = JsonUtil.parseStringAsJsonObject(json.substring(2));
|
||||
cp.topic2cIds = JsonUtil.fromJson(data.get("topic2cIds").toString(), topic2cIdsType);
|
||||
JsonObject id2Consumers = data.getAsJsonObject("id2Consumers");
|
||||
for (String k : id2Consumers.keySet()) {
|
||||
@ -183,7 +183,7 @@ public class EventRecorder {
|
||||
String json = KeyValueRocksDBUtil.instance.getValue(dbName, TEMP_TOPIC_KEYS);
|
||||
Map<String, Long> ret = new ConcurrentHashMap<>();
|
||||
try {
|
||||
JsonObject jo = JsonUtil.parseString(json);
|
||||
JsonObject jo = JsonUtil.parseStringAsJsonObject(json);
|
||||
for (String key : jo.keySet()) {
|
||||
ret.put(key, jo.get(key).getAsLong());
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public class WSClientConsumer implements IEventConsumer {
|
||||
JsonObject ret = new JsonObject();
|
||||
ret.addProperty("action", "onEvent");
|
||||
ret.addProperty("status", "Success");
|
||||
ret.add("data", JsonUtil.parseString(msg));
|
||||
ret.add("data", JsonUtil.parseStringAsJsonObject(msg));
|
||||
channel.writeAndFlush(new TextWebSocketFrame(ret.toString()));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user