From daa99f8698d1557c84d08f404cdfc954e9546e13 Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Thu, 25 Mar 2021 09:20:15 +0100 Subject: [PATCH] Simplify return path for reading collections. Reduce the nesting level of byte[] checks and processing. Original Pull Request: #2015 --- .../redis/core/convert/MappingRedisConverter.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java b/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java index b70a5aa0c..e86696b49 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java +++ b/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java @@ -284,15 +284,14 @@ public class MappingRedisConverter implements RedisConverter, InitializingBean { if (typeInformation.isCollectionLike()) { - if (isByteArray(typeInformation)) { + if (!isByteArray(typeInformation)) { - // accept collection form for byte[] if there's no dedicated key - if (!source.getBucket().hasValue(currentPath) && isByteArray(typeInformation)) { + return readCollectionOrArray(currentPath, typeInformation.getType(), + typeInformation.getRequiredComponentType().getType(), source.getBucket()); + } + + if (!source.getBucket().hasValue(currentPath) && isByteArray(typeInformation)) { - return readCollectionOrArray(currentPath, typeInformation.getType(), - typeInformation.getRequiredComponentType().getType(), source.getBucket()); - } - } else { return readCollectionOrArray(currentPath, typeInformation.getType(), typeInformation.getRequiredComponentType().getType(), source.getBucket()); }