You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2021/10/08 18:00:12 UTC

[cxf] branch 3.3.x-fixes updated: [CXF-8603]ClassLoaderUtils.setThreadContextClassloader attempts to set null class loader

This is an automated email from the ASF dual-hosted git repository.

ffang pushed a commit to branch 3.3.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/3.3.x-fixes by this push:
     new d675adc  [CXF-8603]ClassLoaderUtils.setThreadContextClassloader attempts to set null class loader
d675adc is described below

commit d675adcc13796cf81a1489f4eac6a239ea6c9382
Author: Freeman Fang <fr...@gmail.com>
AuthorDate: Fri Oct 8 12:56:54 2021 -0400

    [CXF-8603]ClassLoaderUtils.setThreadContextClassloader attempts to set null class loader
    
    (cherry picked from commit b1753fa70a86292e0965cf570fae5d81e280080a)
    (cherry picked from commit c949fb0977ebde946fb5d0c942f1cca6ef7af186)
---
 core/src/main/java/org/apache/cxf/helpers/XPathUtils.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/core/src/main/java/org/apache/cxf/helpers/XPathUtils.java b/core/src/main/java/org/apache/cxf/helpers/XPathUtils.java
index 7475434..77d3f41 100644
--- a/core/src/main/java/org/apache/cxf/helpers/XPathUtils.java
+++ b/core/src/main/java/org/apache/cxf/helpers/XPathUtils.java
@@ -69,8 +69,10 @@ public class XPathUtils {
     }
 
     public Object getValue(String xpathExpression, Node node, QName type) {
-        ClassLoaderHolder loader
-            = ClassLoaderUtils.setThreadContextClassloader(getClassLoader(xpath.getClass()));
+        ClassLoaderHolder loader = null;
+        if (getClassLoader(xpath.getClass()) != null) {
+            loader = ClassLoaderUtils.setThreadContextClassloader(getClassLoader(xpath.getClass()));
+        }
         try {
             return xpath.evaluate(xpathExpression, node, type);
         } catch (Exception e) {