You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by as...@apache.org on 2017/04/26 15:47:43 UTC

[1/2] cxf git commit: [CXF-7339] Fix NPE due to weak reference being GC-ed

Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes 0487b301a -> c74fd3862


[CXF-7339] Fix NPE due to weak reference being GC-ed


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

Branch: refs/heads/3.1.x-fixes
Commit: a0aa23493598c6e7d2d9d41fd086bea430d4c6b5
Parents: 0487b30
Author: Alessio Soldano <as...@redhat.com>
Authored: Wed Apr 19 00:48:39 2017 +0200
Committer: Alessio Soldano <as...@redhat.com>
Committed: Wed Apr 26 17:46:29 2017 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/cxf/common/jaxb/JAXBContextCache.java  | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/a0aa2349/core/src/main/java/org/apache/cxf/common/jaxb/JAXBContextCache.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/jaxb/JAXBContextCache.java b/core/src/main/java/org/apache/cxf/common/jaxb/JAXBContextCache.java
index dcbe9fc..8d9bcb7 100644
--- a/core/src/main/java/org/apache/cxf/common/jaxb/JAXBContextCache.java
+++ b/core/src/main/java/org/apache/cxf/common/jaxb/JAXBContextCache.java
@@ -229,7 +229,10 @@ public final class JAXBContextCache {
                 if (cachedContextAndSchemasInternal != null) {
                     context = cachedContextAndSchemasInternal.getContext();
                     if (context == null) {
-                        JAXBCONTEXT_CACHE.remove(cachedContextAndSchemasInternal.getClasses());
+                        final Set<Class<?>> cls = cachedContextAndSchemasInternal.getClasses();
+                        if (cls != null) {
+                            JAXBCONTEXT_CACHE.remove(cls);
+                        }
                         cachedContextAndSchemasInternal = null;
                     } else {
                         return new CachedContextAndSchemas(context, cachedContextAndSchemasInternal.getClasses(),


[2/2] cxf git commit: [CXF-7339] Null key support in CacheMap

Posted by as...@apache.org.
[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/c74fd386
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c74fd386
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c74fd386

Branch: refs/heads/3.1.x-fixes
Commit: c74fd38620b905b096e02dd987e6a97bc5e0a616
Parents: a0aa234
Author: Alessio Soldano <as...@redhat.com>
Authored: Wed Apr 26 16:25:34 2017 +0200
Committer: Alessio Soldano <as...@redhat.com>
Committed: Wed Apr 26 17:46:41 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/c74fd386/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 15b6963..1f4b820 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/c74fd386/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));
     }
 
 }