diff --git a/CHANGES.md b/CHANGES.md index 625402eed..d465d2d7f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -153,6 +153,7 @@ Callable { * Support asynchronous invocation in jetty client 9.0 and 9.x plugin * Add nacos-client 2.x plugin * Staticize the tags for preventing synchronization in JDK 8 +* Fix NullPointerException in lettuce-5.x-plugin. #### Documentation diff --git a/apm-sniffer/apm-sdk-plugin/lettuce-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/lettuce/v5/RedisChannelWriterInterceptor.java b/apm-sniffer/apm-sdk-plugin/lettuce-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/lettuce/v5/RedisChannelWriterInterceptor.java index 3e5c670e7..c1d731e43 100644 --- a/apm-sniffer/apm-sdk-plugin/lettuce-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/lettuce/v5/RedisChannelWriterInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/lettuce-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/lettuce/v5/RedisChannelWriterInterceptor.java @@ -101,9 +101,12 @@ public class RedisChannelWriterInterceptor implements InstanceMethodsAroundInter CommandArgs args = redisCommand.getArgs(); if (args == null) { return Constants.EMPTY_STRING; - } + } ByteBuffer firstEncodedKey = args.getFirstEncodedKey(); - String key = STRING_CODEC.decodeKey(firstEncodedKey); + if (firstEncodedKey == null) { + return Constants.EMPTY_STRING; + } + String key = STRING_CODEC.decodeKey(firstEncodedKey); if (StringUtil.isNotEmpty(key) && key.length() > LettucePluginConfig.Plugin.Lettuce.REDIS_PARAMETER_MAX_LENGTH) { key = StringUtil.cut(key, LettucePluginConfig.Plugin.Lettuce.REDIS_PARAMETER_MAX_LENGTH) + ABBR; }