From 74795cb3229f6d10fabed4ad3aee9ed902e98773 Mon Sep 17 00:00:00 2001 From: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com> Date: Wed, 27 Nov 2024 21:50:55 +0600 Subject: [PATCH 1/2] Make reply of ACL LOG compatible with older Redis versions (#4030) --- .../redis/clients/jedis/resps/AccessControlLogEntry.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/redis/clients/jedis/resps/AccessControlLogEntry.java b/src/main/java/redis/clients/jedis/resps/AccessControlLogEntry.java index 930c9b064d..922d37fd6a 100644 --- a/src/main/java/redis/clients/jedis/resps/AccessControlLogEntry.java +++ b/src/main/java/redis/clients/jedis/resps/AccessControlLogEntry.java @@ -47,9 +47,10 @@ public AccessControlLogEntry(Map map) { ageSeconds = (Double) map.get(AGE_SECONDS); clientInfo = getMapFromRawClientInfo((String) map.get(CLIENT_INFO)); logEntry = map; - entryId = (long) map.get(ENTRY_ID); - timestampCreated = (long) map.get(TIMESTAMP_CREATED); - timestampLastUpdated = (long) map.get(TIMESTAMP_LAST_UPDATED); + // Redis 7.2 + entryId = map.containsKey(ENTRY_ID) ? (long) map.get(ENTRY_ID) : -1L; + timestampCreated = map.containsKey(TIMESTAMP_CREATED) ? (long) map.get(TIMESTAMP_CREATED) : -1L; + timestampLastUpdated = map.containsKey(TIMESTAMP_LAST_UPDATED) ? (long) map.get(TIMESTAMP_LAST_UPDATED) : -1L; } public long getCount() { From d34b36eae20d4482df83330a0551edfe818190fc Mon Sep 17 00:00:00 2001 From: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com> Date: Wed, 27 Nov 2024 22:10:50 +0600 Subject: [PATCH 2/2] Make reply of COMMAND INFO compatible with older Redis versions (#4031) --- 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); }