cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r608369 - /incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java
Date Thu, 03 Jan 2008 07:42:20 GMT
Author: ffang
Date: Wed Jan  2 23:42:20 2008
New Revision: 608369

URL: http://svn.apache.org/viewvc?rev=608369&view=rev
Log:
[CXF-1351] static DocumentBuilderFactory in XMLUtils cause ClassCastException when use different
classloader

Modified:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java?rev=608369&r1=608368&r2=608369&view=diff
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java (original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java Wed
Jan  2 23:42:20 2008
@@ -88,6 +88,13 @@
     }
 
     public static DocumentBuilder getParser() throws ParserConfigurationException {
+        if (parserFactory.getClass().getClassLoader() != null 
+            && !parserFactory.getClass().getClassLoader().equals(
+                Thread.currentThread().getContextClassLoader())) {
+            //not the same classloader which init parserFactory, so create parserFactory
with new classLoader
+            parserFactory = DocumentBuilderFactory.newInstance();
+            parserFactory.setNamespaceAware(true);
+        }
         return parserFactory.newDocumentBuilder();
     }
 



Mime
View raw message