forked from spring-projects/spring-data-redis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Polish for Issue spring-projects#2655 and PR spring-projects#2672.
See spring-projects#2655 Original pull request: spring-projects#2672
- Loading branch information
Showing
11 changed files
with
90 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
import org.springframework.data.redis.connection.ReactiveHashCommands; | ||
import org.springframework.data.redis.connection.convert.Converters; | ||
import org.springframework.data.redis.serializer.RedisSerializationContext; | ||
import org.springframework.data.redis.util.RedisAssertions; | ||
import org.springframework.lang.Nullable; | ||
import org.springframework.util.Assert; | ||
|
||
|
@@ -211,7 +212,7 @@ public Flux<HV> values(H key) { | |
|
||
Assert.notNull(key, "Key must not be null"); | ||
|
||
return createFlux(connection -> connection.hVals(rawKey(key)) // | ||
return createFlux(hashCommands -> hashCommands.hVals(rawKey(key)) // | ||
.map(this::readRequiredHashValue)); | ||
} | ||
|
||
|
@@ -276,30 +277,20 @@ private HK readHashKey(ByteBuffer value) { | |
|
||
private HK readRequiredHashKey(ByteBuffer buffer) { | ||
|
||
HK hashKey = readHashKey(buffer); | ||
|
||
if (hashKey == null) { | ||
throw new InvalidDataAccessApiUsageException("Deserialized hash key is null"); | ||
} | ||
|
||
return hashKey; | ||
return RedisAssertions.requireNonNull(readHashKey(buffer), | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jxblum
Author
Owner
|
||
() -> new InvalidDataAccessApiUsageException("Deserialized hash key is null")); | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
@Nullable | ||
private HV readHashValue(@Nullable ByteBuffer value) { | ||
return (HV) (value == null ? null : serializationContext.getHashValueSerializationPair().read(value)); | ||
return value != null ? (HV) serializationContext.getHashValueSerializationPair().read(value) : null; | ||
} | ||
|
||
private HV readRequiredHashValue(ByteBuffer buffer) { | ||
|
||
HV hashValue = readHashValue(buffer); | ||
|
||
if (hashValue == null) { | ||
throw new InvalidDataAccessApiUsageException("Deserialized hash value is null"); | ||
} | ||
|
||
return hashValue; | ||
return RedisAssertions.requireNonNull(readHashValue(buffer), | ||
() -> new InvalidDataAccessApiUsageException("Deserialized hash value is null")); | ||
} | ||
|
||
private Map.Entry<HK, HV> deserializeHashEntry(Map.Entry<ByteBuffer, ByteBuffer> source) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
RedisAssertions
adds a lot of noise and isn't otherwise helpful. Please revert those changes across the board.