HCOLL-277 HCOLL-278 HCOLL-289 Fixed two bugs in VanillaChronicleMap.putValue()

This commit is contained in:
leventov
2015-01-03 01:56:49 +07:00
parent cbf727ae7a
commit db594bfb64
7 changed files with 27 additions and 13 deletions
@@ -240,9 +240,12 @@ class IntIntMultiMap implements MultiMap {
@Override
public void replacePrevPos(SearchState searchState, long newValue) {
checkValueForPut(newValue);
long prevPos = stepBack(searchState.searchPos);
long prevPos = searchState.searchPos;
if (!searchState.putAfterFailedSearch)
prevPos = stepBack(prevPos);
long oldEntry = bytes.readLong(prevPos);
long oldValue = value(oldEntry);
checkValueForRemove(oldValue);
positions.clear(oldValue);
positions.set(newValue);
bytes.writeLong(prevPos, entry(searchState.searchHash, newValue));