DATAREDIS-824 - Fix potential NPE in DefaultReactiveHashOperations when deserializing values.
Avoid ByteBuffer creation for null values indicating absent keys in hash. Original Pull Request: #340
This commit is contained in:
committed by
Christoph Strobl
parent
42aac673f6
commit
2c1ee77b87
@@ -277,7 +277,7 @@ class DefaultReactiveHashOperations<H, HK, HV> implements ReactiveHashOperations
|
||||
|
||||
List<HV> values = new ArrayList<>(source.size());
|
||||
for (ByteBuffer byteBuffer : source) {
|
||||
values.add(readHashValue(byteBuffer));
|
||||
values.add(byteBuffer == null ? null : readHashValue(byteBuffer));
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
@@ -178,6 +178,12 @@ public class DefaultReactiveHashOperationsIntegrationTests<K, HK, HV> {
|
||||
HK hashkey2 = hashKeyFactory.instance();
|
||||
HV hashvalue2 = hashValueFactory.instance();
|
||||
|
||||
StepVerifier.create(hashOperations.multiGet(key, Arrays.asList(hashkey1, hashkey2))) //
|
||||
.consumeNextWith(actual -> {
|
||||
assertThat(actual).hasSize(2).containsSequence(null, null);
|
||||
}) //
|
||||
.verifyComplete();
|
||||
|
||||
putAll(key, hashkey1, hashvalue1, hashkey2, hashvalue2);
|
||||
|
||||
StepVerifier.create(hashOperations.multiGet(key, Arrays.asList(hashkey1, hashkey2))) //
|
||||
|
||||
Reference in New Issue
Block a user