package com.vaguehope.onosendai.storage;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class VolatileKvStore implements KvStore {

	private final Map<String, String> m = new ConcurrentHashMap<String, String>();

	@Override
	public void storeValue (final String key, final String value) {
		this.m.put(key, value);
	}

	@Override
	public void deleteValue (final String key) {
		this.m.remove(key);
	}

	@Override
	public String getValue (final String key) {
		return this.m.get(key);
	}

}

@@ -319,31 +319,185 @@
 %7B%0A%09%09
-this.m.put(key, value);
+if (key == null) throw new IllegalArgumentException(%22Can not store against null key.%22);%0A%09%09if (value != null) %7B%0A%09%09%09this.m.put(key, value);%0A%09%09%7D%0A%09%09else %7B%0A%09%09%09this.m.remove(key);%0A%09%09%7D
 %0A%09%7D%0A

Fix NPE when refreshing SW token and using in memory cache.