[hibernate-dev] Solution for failing Isolated query cache tests in Hibernate trunk

Steve Ebersole steve at hibernate.org
Wed Jan 13 12:59:53 EST 2010


http://opensource.atlassian.com/projects/hibernate/browse/HHH-4786


On Wed, 2010-01-13 at 17:31 +0100, Galder Zamarreno wrote:
> Hi all,
> 
> In Hibernate trunk, the following tests are failing:
> 
> In JBC 2LC provider:
> MVCCIsolatedClassLoaderTest.testClassLoaderHandlingNamedQueryRegion
> MVCCIsolatedClassLoaderTest.testClassLoaderHandlingStandardQueryCache
> 
> In Infinispan 2LC provider:
> IsolatedClassLoaderTest.testClassLoaderHandlingNamedQueryRegion
> IsolatedClassLoaderTest.testClassLoaderHandlingStandardQueryCache
> 
> They're failing because AccountHolder is being loaded with the system 
> classloader rather than the SelectedClassnameClassLoader.
> 
> The reason for this is that as a result of 
> http://opensource.atlassian.com/projects/hibernate/browse/HHH-2990, 
> SerializationHelper.CustomObjectInputStream now takes the classloader in 
> the constructor. And during the test, SerializableType.fromBytes passes 
> null as classloader to this constructor. The null comes from 
> getReturnedClass().getClassLoader() below, which has been added as a 
> result of 2990.
> 
>      private Object fromBytes(byte[] bytes) throws SerializationException {
>          return SerializationHelper.deserialize( bytes, 
> getReturnedClass().getClassLoader() );
>      }
> 
> Now, shouldn't we use Thread.currentThread().getContextClassLoader() 
> instead of getReturnedClass().getClassLoader()? Previously, that's what 
> would have happened. I dunno why getReturnedClass().getClassLoader() was 
> added though.
> 
> I've just tested using Thread.currentThread().getContextClassLoader() 
> change and the tests pass now. Steve?
> 
> Cheers,
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
-- 
Steve Ebersole <steve at hibernate.org>
Hibernate.org




More information about the hibernate-dev mailing list