cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asold...@apache.org
Subject [1/2] cxf git commit: [CXF-7339] Null key support in CacheMap
Date Wed, 26 Apr 2017 15:38:57 GMT
Repository: cxf
Updated Branches:
  refs/heads/master f4d0b2152 -> 993439e90


[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/993439e9
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/993439e9
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/993439e9

Branch: refs/heads/master
Commit: 993439e9061ae59abc65b924b2414b7b898deb9d
Parents: eef5bc6
Author: Alessio Soldano <asoldano@redhat.com>
Authored: Wed Apr 26 16:25:34 2017 +0200
Committer: Alessio Soldano <asoldano@redhat.com>
Committed: Wed Apr 26 16:25:55 2017 +0200

----------------------------------------------------------------------
 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/993439e9/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 5a4a419..4562fb77 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/993439e9/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