This is an automated email from the ASF dual-hosted git repository.
mthomsen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new 90f44d9 NiFi-8152: Fix NPE in RedisDistributedMapCacheClientService
caused by newer versions of Jedis
90f44d9 is described below
commit 90f44d9d62edf0fee5543adf48441a7a205f29f4
Author: Bernhard Geisberger <[email protected]>
AuthorDate: Tue Jan 26 15:29:30 2021 +0100
NiFi-8152: Fix NPE in RedisDistributedMapCacheClientService caused by newer
versions of Jedis
This closes #4783
Signed-off-by: Mike Thomsen <[email protected]>
---
.../nifi/redis/service/RedisDistributedMapCacheClientService.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git
a/nifi-nar-bundles/nifi-redis-bundle/nifi-redis-extensions/src/main/java/org/apache/nifi/redis/service/RedisDistributedMapCacheClientService.java
b/nifi-nar-bundles/nifi-redis-bundle/nifi-redis-extensions/src/main/java/org/apache/nifi/redis/service/RedisDistributedMapCacheClientService.java
index 45ceef2..7fd6c9b 100644
---
a/nifi-nar-bundles/nifi-redis-bundle/nifi-redis-extensions/src/main/java/org/apache/nifi/redis/service/RedisDistributedMapCacheClientService.java
+++
b/nifi-nar-bundles/nifi-redis-bundle/nifi-redis-extensions/src/main/java/org/apache/nifi/redis/service/RedisDistributedMapCacheClientService.java
@@ -161,8 +161,9 @@ public class RedisDistributedMapCacheClientService extends
AbstractControllerSer
final List<Object> results = redisConnection.exec();
// if the results list was empty, then the transaction failed
(i.e. key was modified after we started watching), so keep looping to retry
+ // if the results list was null, then the transaction failed
// if the results list has results, then the transaction
succeeded and it should have the result of the setNX operation
- if (results.size() > 0) {
+ if (results != null && results.size() > 0) {
final Object firstResult = results.get(0);
if (firstResult instanceof Boolean) {
final Boolean absent = (Boolean) firstResult;
@@ -337,7 +338,7 @@ public class RedisDistributedMapCacheClientService extends
AbstractControllerSer
final List<Object> results = redisConnection.exec();
// if we have a result then the replace succeeded
- if (results.size() > 0) {
+ if (results != null && results.size() > 0) {
replaced = true;
}