From b8761761cd189fc7c27366d77a50372ab6882ff8 Mon Sep 17 00:00:00 2001 From: liqs1123 Date: Tue, 13 Dec 2022 16:38:11 +0800 Subject: [PATCH] fix bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复获取区块链节点状态信息返回报文解析报错。 --- .../com/webank/webase/data/collect/node/NodeService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/WeBASE-Data-Collect/src/main/java/com/webank/webase/data/collect/node/NodeService.java b/WeBASE-Data-Collect/src/main/java/com/webank/webase/data/collect/node/NodeService.java index 73b0ef63..9d518961 100644 --- a/WeBASE-Data-Collect/src/main/java/com/webank/webase/data/collect/node/NodeService.java +++ b/WeBASE-Data-Collect/src/main/java/com/webank/webase/data/collect/node/NodeService.java @@ -31,6 +31,7 @@ import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.concurrent.CountDownLatch; import lombok.extern.log4j.Log4j2; @@ -332,15 +333,15 @@ private List getPeerOfConsensusStatus(int chainId, int gr if (StringUtils.isBlank(consensusStatusJson)) { return null; } - List jsonArr = JacksonUtils.stringToObj(consensusStatusJson, List.class); + Map jsonArr = JacksonUtils.stringToObj(consensusStatusJson, Map.class); if (jsonArr == null) { return null; } List dataIsList = new ArrayList<>(); for (int i = 0; i < jsonArr.size(); i++) { - if (jsonArr.get(i) instanceof List) { + if (jsonArr.get("viewInfos") instanceof List) { List tempList = - JacksonUtils.stringToObj(JacksonUtils.objToString(jsonArr.get(i)), + JacksonUtils.stringToObj(JacksonUtils.objToString(jsonArr.get("viewInfos")), new TypeReference>() {}); if (tempList != null) { dataIsList.addAll(tempList);