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