diff --git a/pom.xml b/pom.xml index f6cb8c102..066b3ff6f 100755 --- a/pom.xml +++ b/pom.xml @@ -77,6 +77,7 @@ net.openhft chronicle-algorithms + 1.1.8 diff --git a/src/main/java/net/openhft/chronicle/hash/impl/stage/iter/TierRecovery.java b/src/main/java/net/openhft/chronicle/hash/impl/stage/iter/TierRecovery.java index be13a9b1e..cd87edc40 100644 --- a/src/main/java/net/openhft/chronicle/hash/impl/stage/iter/TierRecovery.java +++ b/src/main/java/net/openhft/chronicle/hash/impl/stage/iter/TierRecovery.java @@ -262,8 +262,8 @@ public class TierRecovery { long searchKeyFromKey = h.hashLookup.maskUnsetKey(segmentHashFromKey); if (searchKey != searchKeyFromKey) { log.error("HashLookup searchKey: {}, HashLookup searchKey " + - "from the entry key hash code: {}, entry key: {}", - searchKey, searchKeyFromKey, e.key()); + "from the entry key hash code: {}, entry key: {}, entry pos: {}", + searchKey, searchKeyFromKey, e.key(), entryPos); return -1; } diff --git a/src/test/java/net/openhft/chronicle/map/NegativeIntegerKeyTest.java b/src/test/java/net/openhft/chronicle/map/NegativeIntegerKeyTest.java new file mode 100644 index 000000000..b19ab9894 --- /dev/null +++ b/src/test/java/net/openhft/chronicle/map/NegativeIntegerKeyTest.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2016 Roman Leventov + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package net.openhft.chronicle.map; + +import org.junit.Assert; +import org.junit.Test; + +import java.io.File; +import java.io.IOException; + +public class NegativeIntegerKeyTest { + + @Test + public void testNegativeIntegerKey() throws IOException { + File file = ChronicleMapTest.getPersistenceFile(); + try (ChronicleMap map = ChronicleMap + .of(Integer.class, Integer.class) + .entries(1) + .createPersistedTo(file)) { + map.put(-1, -1); + } + try (ChronicleMap map = ChronicleMap + .of(Integer.class, Integer.class) + .entries(1) + .recoverPersistedTo(file, true)) { + Assert.assertEquals(Integer.valueOf(-1), map.get(-1)); + } + } +} \ No newline at end of file