Fix lettuce NullPointerException (#599)

This commit is contained in:
gzlicanyi 2023-08-28 19:01:03 +08:00 committed by GitHub
parent 9a65fcbd6b
commit afa257811b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -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;
}