diff --git a/instrumentation/jedis-3.0.0/src/main/java/redis/clients/jedis/Connection_Instrumentation.java b/instrumentation/jedis-3.0.0/src/main/java/redis/clients/jedis/Connection_Instrumentation.java index 46c3a2aa25..d6d02de1cf 100644 --- a/instrumentation/jedis-3.0.0/src/main/java/redis/clients/jedis/Connection_Instrumentation.java +++ b/instrumentation/jedis-3.0.0/src/main/java/redis/clients/jedis/Connection_Instrumentation.java @@ -41,16 +41,18 @@ public void disconnect() { @Trace(leaf = true) public void sendCommand(final ProtocolCommand cmd, final byte[]... args) { Weaver.callOriginal(); - - updateDbIndex(cmd, new String(args[0], StandardCharsets.UTF_8)); + if (args != null && args.length > 0) { + updateDbIndex(cmd, new String(args[0], StandardCharsets.UTF_8)); + } reportMethodAsExternal(cmd, getHost(), getPort()); } @Trace(leaf = true) public void sendCommand(final ProtocolCommand cmd, final String... args) { Weaver.callOriginal(); - - updateDbIndex(cmd, args[0]); + if (args != null && args.length > 0) { + updateDbIndex(cmd, args[0]); + } reportMethodAsExternal(cmd, getHost(), getPort()); } diff --git a/instrumentation/jedis-4.0.0/src/main/java/redis/clients/jedis/Connection_Instrumentation.java b/instrumentation/jedis-4.0.0/src/main/java/redis/clients/jedis/Connection_Instrumentation.java index cd4135685e..9b44308674 100644 --- a/instrumentation/jedis-4.0.0/src/main/java/redis/clients/jedis/Connection_Instrumentation.java +++ b/instrumentation/jedis-4.0.0/src/main/java/redis/clients/jedis/Connection_Instrumentation.java @@ -38,16 +38,17 @@ public void disconnect() { @Trace public void sendCommand(final ProtocolCommand cmd, final byte[]... args) { Weaver.callOriginal(); - - updateDbIndex(cmd, new String(args[0], StandardCharsets.UTF_8)); - + if (args != null && args.length > 0) { + updateDbIndex(cmd, new String(args[0], StandardCharsets.UTF_8)); + } } @Trace public void sendCommand(final ProtocolCommand cmd, final String... args) { Weaver.callOriginal(); - - updateDbIndex(cmd, args[0]); + if (args != null && args.length > 0) { + updateDbIndex(cmd, args[0]); + } } @Trace(leaf = true)