From 1a64d98697190a71e0ce2964c32d0451679a76d5 Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Sun, 12 Dec 2021 02:40:26 +0100 Subject: [PATCH] Bugfixes --- src/main/java/it/cavallium/dbengine/database/LLUtils.java | 3 +++ .../database/collections/DatabaseMapDictionaryDeep.java | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/it/cavallium/dbengine/database/LLUtils.java b/src/main/java/it/cavallium/dbengine/database/LLUtils.java index c793f76..966b619 100644 --- a/src/main/java/it/cavallium/dbengine/database/LLUtils.java +++ b/src/main/java/it/cavallium/dbengine/database/LLUtils.java @@ -644,6 +644,9 @@ public class LLUtils { @Nullable public static ByteBuffer asReadOnlyDirect(Buffer inputBuffer) { var bytes = inputBuffer.readableBytes(); + if (bytes == 0) { + return EMPTY_BYTE_BUFFER; + } if (inputBuffer instanceof ReadableComponent rc) { var componentBuffer = rc.readableBuffer(); if (componentBuffer != null && componentBuffer.isDirect()) { diff --git a/src/main/java/it/cavallium/dbengine/database/collections/DatabaseMapDictionaryDeep.java b/src/main/java/it/cavallium/dbengine/database/collections/DatabaseMapDictionaryDeep.java index 2a31154..1a6f704 100644 --- a/src/main/java/it/cavallium/dbengine/database/collections/DatabaseMapDictionaryDeep.java +++ b/src/main/java/it/cavallium/dbengine/database/collections/DatabaseMapDictionaryDeep.java @@ -322,8 +322,8 @@ public class DatabaseMapDictionaryDeep> extend .subStage(dictionary, snapshot, Mono.fromCallable(() -> groupKeyWithoutExtSend.copy().send())) .>handle((us, sink) -> { T deserializedSuffix; - try { - deserializedSuffix = this.deserializeSuffix(splitGroupSuffix(groupKeyWithoutExtSend)); + try (var splittedGroupSuffix = splitGroupSuffix(groupKeyWithoutExtSend)) { + deserializedSuffix = this.deserializeSuffix(splittedGroupSuffix); sink.next(Map.entry(deserializedSuffix, us)); } catch (SerializationException ex) { sink.error(ex);