Skip to content

Commit afa2578

Browse files
authored
Fix lettuce NullPointerException (#599)
1 parent 9a65fcb commit afa2578

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ Callable {
153153
* Support asynchronous invocation in jetty client 9.0 and 9.x plugin
154154
* Add nacos-client 2.x plugin
155155
* Staticize the tags for preventing synchronization in JDK 8
156+
* Fix NullPointerException in lettuce-5.x-plugin.
156157

157158
#### Documentation
158159

apm-sniffer/apm-sdk-plugin/lettuce-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/lettuce/v5/RedisChannelWriterInterceptor.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,12 @@ private String getArgsKey(RedisCommand<?, ?, ?> redisCommand) {
101101
CommandArgs<?, ?> args = redisCommand.getArgs();
102102
if (args == null) {
103103
return Constants.EMPTY_STRING;
104-
}
104+
}
105105
ByteBuffer firstEncodedKey = args.getFirstEncodedKey();
106-
String key = STRING_CODEC.decodeKey(firstEncodedKey);
106+
if (firstEncodedKey == null) {
107+
return Constants.EMPTY_STRING;
108+
}
109+
String key = STRING_CODEC.decodeKey(firstEncodedKey);
107110
if (StringUtil.isNotEmpty(key) && key.length() > LettucePluginConfig.Plugin.Lettuce.REDIS_PARAMETER_MAX_LENGTH) {
108111
key = StringUtil.cut(key, LettucePluginConfig.Plugin.Lettuce.REDIS_PARAMETER_MAX_LENGTH) + ABBR;
109112
}

0 commit comments

Comments
 (0)