This commit is contained in:
Andrea Cavalli 2021-06-02 13:21:07 +02:00
parent f95a46b634
commit 187274071f

View File

@ -574,9 +574,14 @@ public class LLLocalDictionary implements LLDictionary {
ByteBuf prevDataToSendToUpdater = prevData == null ? null : prevData.retainedSlice(); ByteBuf prevDataToSendToUpdater = prevData == null ? null : prevData.retainedSlice();
try { try {
newData = updater.apply(prevDataToSendToUpdater == null ? null : prevDataToSendToUpdater.retain()); newData = updater.apply(prevDataToSendToUpdater == null ? null : prevDataToSendToUpdater.retain());
assert prevDataToSendToUpdater == null if (!(prevDataToSendToUpdater == null
|| prevDataToSendToUpdater.readerIndex() == 0 || prevDataToSendToUpdater.readerIndex() == 0
|| !prevDataToSendToUpdater.isReadable(); || !prevDataToSendToUpdater.isReadable())) {
throw new IllegalStateException("The updater has read the previous data partially"
+ " (read bytes: " + prevDataToSendToUpdater.readerIndex()
+ " unread bytes: " + prevDataToSendToUpdater.readableBytes() + ")."
+ " The only allowed options are reading the data fully or not reading it at all");
}
} finally { } finally {
if (prevDataToSendToUpdater != null) { if (prevDataToSendToUpdater != null) {
prevDataToSendToUpdater.release(); prevDataToSendToUpdater.release();