From 6ce22f02f7010df0de40195335d2d2dbb3d7b10d Mon Sep 17 00:00:00 2001 From: leventov Date: Sun, 5 Oct 2014 05:58:39 +0400 Subject: [PATCH] Throw IllegalArgumentException with human-readable message in VanillaChronicleMap.Segment.alloc() method on attempt of allocation of more than 64 blocks --- .../java/net/openhft/chronicle/map/VanillaChronicleMap.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java index 3c494cfcc..c35bad84f 100644 --- a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java @@ -897,6 +897,9 @@ class VanillaChronicleMap, } int alloc(int blocks) { + if (blocks > MAX_ENTRY_OVERSIZE_FACTOR) + throw new IllegalArgumentException("Entry is too large: requires " + blocks + + " entry size chucks, " + MAX_ENTRY_OVERSIZE_FACTOR + " is maximum."); int ret = (int) freeList.setNextNContinuousClearBits(nextPosToSearchFrom, blocks); if (ret == DirectBitSet.NOT_FOUND) {