Sho SHIMIZU
Committed by Gerrit Code Review

Fix bug that exception is thrown when key doesn't exist

Change-Id: Ic107b82202f64fb81709310b5e9a705c7e66d542
...@@ -294,7 +294,8 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour ...@@ -294,7 +294,8 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour
294 private <K, V> boolean appendValues(TransactionalMap<K, List<V>> map, K key, List<V> values) { 294 private <K, V> boolean appendValues(TransactionalMap<K, List<V>> map, K key, List<V> values) {
295 List<V> oldValues = map.get(key); 295 List<V> oldValues = map.get(key);
296 if (oldValues == null) { 296 if (oldValues == null) {
297 - return map.replace(key, oldValues, new ArrayList<>(values)); 297 + map.put(key, new ArrayList<>(values));
298 + return true;
298 } 299 }
299 300
300 LinkedHashSet<V> oldSet = new LinkedHashSet<>(oldValues); 301 LinkedHashSet<V> oldSet = new LinkedHashSet<>(oldValues);
...@@ -321,7 +322,8 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour ...@@ -321,7 +322,8 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour
321 private <K, V> boolean removeValues(TransactionalMap<K, List<V>> map, K key, List<V> values) { 322 private <K, V> boolean removeValues(TransactionalMap<K, List<V>> map, K key, List<V> values) {
322 List<V> oldValues = map.get(key); 323 List<V> oldValues = map.get(key);
323 if (oldValues == null) { 324 if (oldValues == null) {
324 - return map.replace(key, oldValues, new ArrayList<>()); 325 + map.put(key, new ArrayList<>());
326 + return true;
325 } 327 }
326 328
327 LinkedHashSet<V> oldSet = new LinkedHashSet<>(oldValues); 329 LinkedHashSet<V> oldSet = new LinkedHashSet<>(oldValues);
......