From 53abb8005c77526ef50d746d1f15c50d6c20b452 Mon Sep 17 00:00:00 2001 From: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com> Date: Wed, 27 Nov 2024 21:27:41 +0600 Subject: [PATCH] Make reply of COMMAND INFO compatible with older Redis versions --- src/main/java/redis/clients/jedis/resps/CommandInfo.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/redis/clients/jedis/resps/CommandInfo.java b/src/main/java/redis/clients/jedis/resps/CommandInfo.java index efdf582102..7dd15c8684 100644 --- a/src/main/java/redis/clients/jedis/resps/CommandInfo.java +++ b/src/main/java/redis/clients/jedis/resps/CommandInfo.java @@ -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 aclCategories = STRING_LIST.build(commandData.get(6)); - List tips = STRING_LIST.build(commandData.get(7)); - Map subcommands = COMMAND_INFO_RESPONSE.build(commandData.get(9)); + // Redis 6.0 + List aclCategories = commandData.size() >= 7 ? STRING_LIST.build(commandData.get(6)) : null; + // Redis 7.0 + List tips = commandData.size() >= 8 ? STRING_LIST.build(commandData.get(7)) : null; + Map subcommands = commandData.size() >= 10 + ? COMMAND_INFO_RESPONSE.build(commandData.get(9)) : null; return new CommandInfo(name, arity, flags, firstKey, lastKey, step, aclCategories, tips, subcommands); }