diff --git a/src/main/debugger/org/bdware/sc/debugger/DebugMain.java b/src/main/debugger/org/bdware/sc/debugger/DebugMain.java index bc0e999..563381e 100644 --- a/src/main/debugger/org/bdware/sc/debugger/DebugMain.java +++ b/src/main/debugger/org/bdware/sc/debugger/DebugMain.java @@ -4,7 +4,6 @@ import com.google.gson.JsonObject; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import org.bdware.sc.ContractProcess; -import org.bdware.sc.YJSPacker; import org.bdware.sc.bean.Contract; import org.bdware.sc.bean.ContractExecType; import org.bdware.sc.conn.ResultCallback; @@ -13,24 +12,9 @@ import org.bdware.sc.http.HttpUtil; import org.bdware.sc.util.FileUtil; import org.bdware.sc.util.JsonUtil; -import java.io.File; import java.util.Map; public class DebugMain { - static class DebugConfig { - String script; - String agentHttpAddr; - String pubKey; - String privKey; - //AutoAppend - - int port; - String cmi; - String dbPath; - int cPort; - Contract contract; - } - static Logger LOGGER = LogManager.getLogger(DebugMain.class); public static void main(String[] args) { @@ -52,8 +36,8 @@ public class DebugMain { String url = String.format(urlFormat, config.agentHttpAddr, config.pubKey); Map resp = HttpUtil.httpGet(url); - String data = (String)resp.get("response"); - LOGGER.info(JsonUtil.toPrettyJson(JsonUtil.parseString(data))); + String data = (String) resp.get("response"); + LOGGER.info(JsonUtil.toPrettyJson(JsonUtil.parseStringAsJsonObject(data))); LOGGER.info("start done!"); } @@ -63,7 +47,7 @@ public class DebugMain { Map resp = HttpUtil.httpGet(url); String data = (String ) resp.get("response"); - JsonObject jsonObject = JsonUtil.parseString(data); + JsonObject jsonObject = JsonUtil.parseStringAsJsonObject(data); config.cmi = jsonObject.get("cmi").getAsString(); config.dbPath = jsonObject.get("dbPath").getAsString(); config.cPort = jsonObject.get("cPort").getAsInt(); @@ -90,4 +74,18 @@ public class DebugMain { msg.arg = arg; return msg; } + + static class DebugConfig { + String script; + String agentHttpAddr; + String pubKey; + String privKey; + //AutoAppend + + int port; + String cmi; + String dbPath; + int cPort; + Contract contract; + } } diff --git a/src/main/java/org/bdware/sc/engine/hook/HomomorphicDecryptHandler.java b/src/main/java/org/bdware/sc/engine/hook/HomomorphicDecryptHandler.java index a83ee99..ddb99a0 100644 --- a/src/main/java/org/bdware/sc/engine/hook/HomomorphicDecryptHandler.java +++ b/src/main/java/org/bdware/sc/engine/hook/HomomorphicDecryptHandler.java @@ -46,7 +46,7 @@ public class HomomorphicDecryptHandler implements AnnotationHook { LOGGER.info("HomomorphicEncryptHandler--------------------------------3: " + privkey); HomoVisitor.privateKey = privkey; ret = getDecryptResult(homoDecryptConf, JsonUtil.parseObject(ret)); - if (ret != null) { + if (null != ret) { return ret; } ret = new JsonObject(); diff --git a/src/main/java/org/bdware/sc/memory/MemoryDump.java b/src/main/java/org/bdware/sc/memory/MemoryDump.java index b6de25e..a9feed5 100644 --- a/src/main/java/org/bdware/sc/memory/MemoryDump.java +++ b/src/main/java/org/bdware/sc/memory/MemoryDump.java @@ -34,7 +34,7 @@ public class MemoryDump implements Serializable { } public static MemoryDump loadFromStr(String memDump) { - JsonObject map = JsonUtil.parseString(memDump); + JsonObject map = JsonUtil.parseStringAsJsonObject(memDump); MemoryDump ret = new MemoryDump(); for (Entry entry : map.entrySet()) { long id = Long.parseLong(entry.getKey());