This commit is contained in:
Andrea Cavalli 2021-05-03 13:22:02 +02:00
parent bd5cd09b2e
commit bc12b22a4b

View File

@ -66,8 +66,10 @@ public class DatabaseMapDictionaryHashed<T, U, TH> implements DatabaseStageMap<T
public @NotNull Entry<T, U> deserialize(@NotNull ByteBuf serialized) { public @NotNull Entry<T, U> deserialize(@NotNull ByteBuf serialized) {
try { try {
int keySuffixLength = serialized.readInt(); int keySuffixLength = serialized.readInt();
T keySuffix = keySuffixSerializer.deserialize(serialized.retainedSlice(serialized.readerIndex(), keySuffixLength)); int initialReaderIndex = serialized.readerIndex();
U value = valueSerializer.deserialize(serialized.retain()); T keySuffix = keySuffixSerializer.deserialize(serialized.retain());
assert serialized.readerIndex() <= initialReaderIndex + keySuffixLength;
U value = valueSerializer.deserialize(serialized.readerIndex(initialReaderIndex + keySuffixLength).retain());
return Map.entry(keySuffix, value); return Map.entry(keySuffix, value);
} finally { } finally {
serialized.release(); serialized.release();