cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [5/6] cxf git commit: [CXF-7339] Null key support in CacheMap
Date Thu, 04 May 2017 18:21:42 GMT
[CXF-7339] Null key support in CacheMap


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/f525fc45
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/f525fc45
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/f525fc45

Branch: refs/heads/3.0.x-fixes
Commit: f525fc45ff0fabbd8e1fe36d9560e5dc0775f3b9
Parents: 9ec5c94
Author: Alessio Soldano <asoldano@redhat.com>
Authored: Wed Apr 26 16:25:34 2017 +0200
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Thu May 4 14:10:37 2017 -0400

----------------------------------------------------------------------
 core/src/main/java/org/apache/cxf/common/util/CacheMap.java     | 2 +-
 core/src/test/java/org/apache/cxf/common/util/CacheMapTest.java | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/f525fc45/core/src/main/java/org/apache/cxf/common/util/CacheMap.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/util/CacheMap.java b/core/src/main/java/org/apache/cxf/common/util/CacheMap.java
index 997af21..9d64c39 100644
--- a/core/src/main/java/org/apache/cxf/common/util/CacheMap.java
+++ b/core/src/main/java/org/apache/cxf/common/util/CacheMap.java
@@ -123,7 +123,7 @@ public class CacheMap<K, V> implements Map<K, V> {
         Set<K> keys = new HashSet<>(extraKeyMap.keySet());
         V v2 = extraKeyMap.remove(key);
         for (K nk : keys) {
-            if (key.equals(nk)) {
+            if ((key != null && key.equals(nk)) || (key == null && nk ==
null)) {
                 V v3 = extraKeyMap.remove(nk);
                 if (v2 == null) {
                     v2 = v3;

http://git-wip-us.apache.org/repos/asf/cxf/blob/f525fc45/core/src/test/java/org/apache/cxf/common/util/CacheMapTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/common/util/CacheMapTest.java b/core/src/test/java/org/apache/cxf/common/util/CacheMapTest.java
index cdec8e4..62cc4c5 100644
--- a/core/src/test/java/org/apache/cxf/common/util/CacheMapTest.java
+++ b/core/src/test/java/org/apache/cxf/common/util/CacheMapTest.java
@@ -39,12 +39,15 @@ public class CacheMapTest {
         String putKey = "test";
         definitions.put(putKey, putValue);
         
+        Assert.assertNull(definitions.remove(null));
+
         String removeKey = new String("test");
         Object removeValue = definitions.remove(removeKey);
         
         Assert.assertEquals(putKey, removeKey);
         Assert.assertEquals(putValue, removeValue);
         Assert.assertTrue(definitions.isEmpty());
+        Assert.assertNull(definitions.remove(null));
     }
 
 }


Mime
View raw message