Author: dkulp
Date: Fri Jan  4 12:44:02 2008
New Revision: 608993

URL: http://svn.apache.org/viewvc?rev=608993&view=rev
Log:
Merged revisions 608369 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/cxf/trunk

........
  r608369 | ffang | 2008-01-03 02:42:20 -0500 (Thu, 03 Jan 2008) | 1 line
  
  [CXF-1351] static DocumentBuilderFactory in XMLUtils cause ClassCastException 
when use different classloader
........

Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    
incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java

Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: 
incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java
URL: 
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java?rev=608993&r1=608992&r2=608993&view=diff
==============================================================================
--- 
incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java
 (original)
+++ 
incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java
 Fri Jan  4 12:44:02 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();
     }
 


Reply via email to