cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Freeman Fang <freeman.f...@iona.com>
Subject Re: svn commit: r608369 - /incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java
Date Fri, 04 Jan 2008 03:44:38 GMT
Hi Dan,

Sure, added check for parents of the contextClassLoader.
If it's ok, would you please sync this commit[1] to 2.0.x fixes branch?
[1]http://svn.apache.org/viewvc?rev=608731&view=rev

Thanks

Freeman

Daniel Kulp wrote:
> Freeman,
>
> This is definitely not a "complete" fix.   With the way we setup the TCK, 
> this will result in a new ParserFactory being created almost all the 
> time which will suck.    The main reason is that the Thread 
> contextClassLoader is the webapps classloader, but the parser is loaded 
> from the tomcat classloader which would be one of the parents of the 
> contextClassloader.   
>
> Thus, the fix probably should check the parents of the contextClassLoader 
> as well.
>
> Dan
>
>
> On Thursday 03 January 2008, ffang@apache.org wrote:
>   
>> 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/mai
>> n/java/org/apache/cxf/helpers/XMLUtils.java?rev=608369&r1=608368&r2=608
>> 369&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