[hibernate-dev] Solution for failing Isolated query cache tests in Hibernate trunk
Galder Zamarreno
galder at jboss.org
Wed Jan 13 11:31:12 EST 2010
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,
More information about the hibernate-dev
mailing list