feat: update logs

optimize logs in NodeCenterClientController; reformat CMHttpServer
This commit is contained in:
Frank.R.Wu 2021-12-11 22:29:24 +08:00
parent 55d7453ab6
commit 33f8bda665
2 changed files with 8 additions and 11 deletions

View File

@ -156,8 +156,9 @@ public class CMHttpServer {
}
private static String[] parseStrAsList(String str) {
if (str == null)
if (str == null) {
return new String[]{};
}
return str.split(",");
}

View File

@ -383,22 +383,18 @@ public class NodeCenterClientController implements NodeCenterConn {
jo.get("pubKey").getAsString(), jo.get("masterAddress").getAsString());
NetworkManager.instance.connectToAgent(jo.get("pubKey").getAsString(), null);
LOGGER.info(
"[CMClientController] "
+ contractID
+ " 查询master结果为 pubKey="
+ jo.get("pubKey").getAsString()
+ " 地址为"
+ jo.get("masterAddress").getAsString());
String.format("the master of contract %s: pubKey=%s address=%s",
contractID,
jo.get("pubKey").getAsString(),
jo.get("masterAddress").getAsString()));
contractID2PubKey.put(contractID, jo.get("pubKey").getAsString());
return jo.get("pubKey").getAsString();
} catch (Exception e) {
e.printStackTrace();
LOGGER.info("[CMClientController] " + contractID + " 查询master结果为 null");
LOGGER.warn("the master of contract " + contractID + " is null! " + e.getMessage());
}
}
} catch (Exception e) {
e.printStackTrace();
LOGGER.info("[CMClientController] " + contractID + " 查询master结果为 null");
LOGGER.warn("the master of contract " + contractID + " is null! " + e.getMessage());
}
return null;
}