Skip to content

Commit d34b36e

Browse files
authored
Make reply of COMMAND INFO compatible with older Redis versions (#4031)
1 parent 74795cb commit d34b36e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main/java/redis/clients/jedis/resps/CommandInfo.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,12 @@ public CommandInfo build(Object data) {
135135
long firstKey = LONG.build(commandData.get(3));
136136
long lastKey = LONG.build(commandData.get(4));
137137
long step = LONG.build(commandData.get(5));
138-
List<String> aclCategories = STRING_LIST.build(commandData.get(6));
139-
List<String> tips = STRING_LIST.build(commandData.get(7));
140-
Map<String, CommandInfo> subcommands = COMMAND_INFO_RESPONSE.build(commandData.get(9));
138+
// Redis 6.0
139+
List<String> aclCategories = commandData.size() >= 7 ? STRING_LIST.build(commandData.get(6)) : null;
140+
// Redis 7.0
141+
List<String> tips = commandData.size() >= 8 ? STRING_LIST.build(commandData.get(7)) : null;
142+
Map<String, CommandInfo> subcommands = commandData.size() >= 10
143+
? COMMAND_INFO_RESPONSE.build(commandData.get(9)) : null;
141144

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

0 commit comments

Comments
 (0)