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 16:57:05 UTC

[cxf] branch master 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 master
in repository https://gitbox.apache.org/repos/asf/cxf.git


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

commit b1753fa70a86292e0965cf570fae5d81e280080a
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
---
 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) {