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:38:57 UTC
[1/2] cxf git commit: [CXF-7339] Null key support in CacheMap
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 <as...@redhat.com>
Authored: Wed Apr 26 16:25:34 2017 +0200
Committer: Alessio Soldano <as...@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));
}
}
[2/2] cxf git commit: [CXF-7339] Fix NPE due to weak reference being
GC-ed
Posted by as...@apache.org.
[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/eef5bc68
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/eef5bc68
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/eef5bc68
Branch: refs/heads/master
Commit: eef5bc685a4147eadb0d7784b926197db6765e2e
Parents: f4d0b21
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 16:25:55 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/eef5bc68/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 924f3ef..d116af6 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(),