@@ -0,0 +1,566 @@
+package sfBugs;%0A%0Aimport java.util.concurrent.ConcurrentHashMap;%0Aimport java.util.concurrent.Semaphore;%0A%0Apublic class Bug2898106 %7B%0A%0A%09private static final ConcurrentHashMap%3CString, Semaphore%3E locks = new ConcurrentHashMap%3CString, Semaphore%3E();%0A%0A%09private static Semaphore getLock(String key) %7B%0A%09%09Semaphore lock = locks.get(key);%0A%09%09if (lock == null) %7B%0A%09%09%09Semaphore newLock = new Semaphore(1, true);%0A%09%09%09lock = locks.putIfAbsent(key, lock);%0A%09%09%09// value, being null, will *always* throw NullPointerException%0A%09%09%09if (lock == null)%0A%09%09%09%09lock = newLock;%0A%09%09%7D%0A%09%09return lock;%0A%09%7D%0A%7D%0A

add test case for source forge bug 2898106