This is an automated email from the ASF dual-hosted git repository.

pvillard31 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 cb90809e29d NIFI-16031 Replaced 
org.springframework.data.redis.connection.RedisStringCommands deprecated set 
method with suggested set method (#11360)
cb90809e29d is described below

commit cb90809e29d80b73bc1cc3903610fbdf4954349f
Author: dan-s1 <[email protected]>
AuthorDate: Sun Jun 21 08:09:31 2026 -0400

    NIFI-16031 Replaced 
org.springframework.data.redis.connection.RedisStringCommands deprecated set 
method with suggested set method (#11360)
---
 .../SimpleRedisDistributedMapCacheClientService.java        | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git 
a/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-extensions/src/main/java/org/apache/nifi/redis/service/SimpleRedisDistributedMapCacheClientService.java
 
b/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-extensions/src/main/java/org/apache/nifi/redis/service/SimpleRedisDistributedMapCacheClientService.java
index 91ce9f98001..98406fc4d38 100644
--- 
a/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-extensions/src/main/java/org/apache/nifi/redis/service/SimpleRedisDistributedMapCacheClientService.java
+++ 
b/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-extensions/src/main/java/org/apache/nifi/redis/service/SimpleRedisDistributedMapCacheClientService.java
@@ -31,7 +31,7 @@ import org.apache.nifi.redis.RedisConnectionPool;
 import org.apache.nifi.redis.util.RedisAction;
 import org.apache.nifi.util.Tuple;
 import org.springframework.data.redis.connection.RedisConnection;
-import org.springframework.data.redis.connection.RedisStringCommands;
+import org.springframework.data.redis.connection.SetCondition;
 import org.springframework.data.redis.core.types.Expiration;
 
 import java.io.ByteArrayOutputStream;
@@ -120,16 +120,15 @@ public class SimpleRedisDistributedMapCacheClientService 
extends AbstractControl
 
                 // 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 the results list has results, then the transaction 
succeeded, and it should have the result of the setNX operation
                 if (results != null && !results.isEmpty()) {
-                    final Object firstResult = results.get(0);
-                    if (firstResult instanceof Boolean) {
-                        final Boolean absent = (Boolean) firstResult;
+                    final Object firstResult = results.getFirst();
+                    if (firstResult instanceof Boolean absent) {
                         return absent ? null : 
valueDeserializer.deserialize(existingValue);
                     } else {
                         // this shouldn't really happen, but just in case 
there is a non-boolean result then bounce out of the loop
                         throw new IOException("Unexpected result from Redis 
transaction: Expected Boolean result, but got "
-                                + firstResult.getClass().getName() + " with 
value " + firstResult.toString());
+                                + firstResult.getClass().getName() + " with 
value " + firstResult);
                     }
                 }
             } while (isEnabled());
@@ -150,7 +149,7 @@ public class SimpleRedisDistributedMapCacheClientService 
extends AbstractControl
     public <K, V> void put(final K key, final V value, final Serializer<K> 
keySerializer, final Serializer<V> valueSerializer) throws IOException {
         withConnection(redisConnection -> {
             final Tuple<byte[], byte[]> kv = serialize(key, value, 
keySerializer, valueSerializer);
-            redisConnection.stringCommands().set(kv.getKey(), kv.getValue(), 
Expiration.seconds(ttl), RedisStringCommands.SetOption.upsert());
+            redisConnection.stringCommands().set(kv.getKey(), kv.getValue(), 
SetCondition.upsert(), Expiration.seconds(ttl));
             return null;
         });
     }

Reply via email to