Skip to content

Commit

Permalink
Make reply of COMMAND INFO compatible with older Redis versions
Browse files Browse the repository at this point in the history
  • Loading branch information
sazzad16 committed Nov 27, 2024
1 parent eb6cc47 commit 53abb80
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/java/redis/clients/jedis/resps/CommandInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,12 @@ public CommandInfo build(Object data) {
long firstKey = LONG.build(commandData.get(3));
long lastKey = LONG.build(commandData.get(4));
long step = LONG.build(commandData.get(5));
List<String> aclCategories = STRING_LIST.build(commandData.get(6));
List<String> tips = STRING_LIST.build(commandData.get(7));
Map<String, CommandInfo> subcommands = COMMAND_INFO_RESPONSE.build(commandData.get(9));
// Redis 6.0
List<String> aclCategories = commandData.size() >= 7 ? STRING_LIST.build(commandData.get(6)) : null;
// Redis 7.0
List<String> tips = commandData.size() >= 8 ? STRING_LIST.build(commandData.get(7)) : null;
Map<String, CommandInfo> subcommands = commandData.size() >= 10
? COMMAND_INFO_RESPONSE.build(commandData.get(9)) : null;

return new CommandInfo(name, arity, flags, firstKey, lastKey, step, aclCategories, tips, subcommands);
}
Expand Down

0 comments on commit 53abb80

Please sign in to comment.