[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 <asold...@redhat.com>
Authored: Wed Apr 19 00:48:39 2017 +0200
Committer: Alessio Soldano <asold...@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(),

Reply via email to