Skip to content

Commit

Permalink
<fix>(jline): fix jline getGroupInfoList bug in light node. (#839)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyonRay authored Mar 21, 2024
1 parent f1fbe87 commit a099c4d
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/main/java/console/command/JlineUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.Set;
import org.fisco.bcos.sdk.v3.client.Client;
import org.fisco.bcos.sdk.v3.client.protocol.response.BcosGroupInfo;
import org.fisco.bcos.sdk.v3.client.protocol.response.BcosGroupInfoList;
import org.fisco.bcos.sdk.v3.contract.precompiled.sysconfig.SystemConfigFeature;
import org.fisco.bcos.sdk.v3.contract.precompiled.sysconfig.SystemConfigService;
import org.fisco.bcos.sdk.v3.model.EnumNodeVersion;
Expand Down Expand Up @@ -201,16 +202,22 @@ private static List<Completer> generateComplters(Client client) {
keys.add(feature.toString());
}
}
Optional<BcosGroupInfo.GroupInfo> group =
client.getGroupInfoList()
.getResult()
.stream()
.filter(groupInfo -> groupInfo.getGroupID().equals(client.getGroup()))
.findFirst();
if (group.isPresent() && !group.get().getNodeList().isEmpty()) {
group.get()
.getNodeList()
.forEach(groupNodeInfo -> keys.addAll(groupNodeInfo.getFeatureKeys()));
BcosGroupInfoList groupInfoList;
try {
groupInfoList = client.getGroupInfoList();
Optional<BcosGroupInfo.GroupInfo> group =
groupInfoList
.getResult()
.stream()
.filter(groupInfo -> groupInfo.getGroupID().equals(client.getGroup()))
.findFirst();
if (group.isPresent() && !group.get().getNodeList().isEmpty()) {
group.get()
.getNodeList()
.forEach(groupNodeInfo -> keys.addAll(groupNodeInfo.getFeatureKeys()));
}
} catch (Exception ignored) {
logger.info("Failed to get group info list, skip feature keys.");
}

for (String command : commands) {
Expand Down

0 comments on commit a099c4d

Please sign in to comment.