From f41cd592488627c69004435540f5878cca666c1a Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Mon, 8 Jun 2020 16:00:27 +0200 Subject: [PATCH 1/2] DATAREDIS-1161 - Prepare issue branch. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 51fbec2551..81e9260c4c 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-redis - 2.4.0-SNAPSHOT + 2.4.0-DATAREDIS-1161-SNAPSHOT Spring Data Redis From 24c38fd655aef73b399fb69640a77a93fad07810 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Mon, 8 Jun 2020 16:02:30 +0200 Subject: [PATCH 2/2] =?UTF-8?q?DATAREDIS-1161=20-=20Avoid=20returning=20nu?= =?UTF-8?q?ll=20in=20ReactiveHashCommands.hGet(=E2=80=A6).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We now use flatMapIterable(…).next() to return the first value from the hash. Previously, if the returned list was empty, we could return a null value in the mapping function which might have caused a exception. --- .../data/redis/connection/ReactiveHashCommands.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/springframework/data/redis/connection/ReactiveHashCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveHashCommands.java index 8d11405156..27877045ab 100644 --- a/src/main/java/org/springframework/data/redis/connection/ReactiveHashCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/ReactiveHashCommands.java @@ -24,6 +24,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.function.Function; import org.reactivestreams.Publisher; import org.springframework.dao.InvalidDataAccessApiUsageException; @@ -282,7 +283,7 @@ public List getFields() { * @see Redis Documentation: HGET */ default Mono hGet(ByteBuffer key, ByteBuffer field) { - return hMGet(key, Collections.singletonList(field)).map(val -> val.isEmpty() ? null : val.iterator().next()); + return hMGet(key, Collections.singletonList(field)).flatMapIterable(Function.identity()).next(); } /**