From 90399303400db8a55ba8ea35333c951f0fb49f14 Mon Sep 17 00:00:00 2001 From: "Frank.R.Wu" Date: Wed, 10 Nov 2021 16:06:53 +0800 Subject: [PATCH] feat: use tools use JsonUtil to replace JsonParser --- src/main/java/org/bdware/sc/memory/MemoryDump.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/bdware/sc/memory/MemoryDump.java b/src/main/java/org/bdware/sc/memory/MemoryDump.java index 87ee216..b6de25e 100644 --- a/src/main/java/org/bdware/sc/memory/MemoryDump.java +++ b/src/main/java/org/bdware/sc/memory/MemoryDump.java @@ -34,10 +34,7 @@ public class MemoryDump implements Serializable { } public static MemoryDump loadFromStr(String memDump) { - JsonElement jo = new com.google.gson.JsonParser().parse(memDump); -// JsonElement objs = jo.getAsJsonObject().get("objects"); -// JsonObject map = objs.getAsJsonObject(); - JsonObject map = jo.getAsJsonObject(); + JsonObject map = JsonUtil.parseString(memDump); MemoryDump ret = new MemoryDump(); for (Entry entry : map.entrySet()) { long id = Long.parseLong(entry.getKey()); @@ -66,7 +63,7 @@ public class MemoryDump implements Serializable { mo = JsonUtil.fromJson(obj, MemoryObject.class); break; default: - System.out.println("[MemoryDump] todo, missing type:" + type.toString()); + System.out.println("[MemoryDump] todo, missing type:" + type); break; } ret.objects.put(id, mo); @@ -221,7 +218,7 @@ public class MemoryDump implements Serializable { obj = Double.parseDouble(mo.data.toString()); break; default: - System.out.println("[MemoryDump] todo, missing type:" + mo.type.toString()); + System.out.println("[MemoryDump] todo, missing type:" + mo.type); break; }