-
Bug
-
Resolution: Done
-
Minor
-
None
-
None
-
Not Required
org.jboss.test.hibernate.test.HibernateConfigurationUnitTestCase fails with the new released hibernate core 3.3.2.GA_CP04
java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:882)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:384)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1340)
at org.jboss.hibernate.jmx.Hibernate.buildSessionFactory(Hibernate.java:320)
at org.jboss.hibernate.jmx.Hibernate.start(Hibernate.java:274)
this is caused by an improvement I made in the SessionFactoryImpl.allCacheRegions, it was HashMap, and I changed it to ConcurrentHashMap to get better performance.
one difference between these two Map implementation is HashMap allows Null key but Concurrent throws NPE if the key is null.
and in the test org.jboss.test.hibernate.test.HibernateConfigurationUnitTestCase, it uses org.jboss.test.hibernate.mocks.MockRegion when initialize SessionFactory, and org.jboss.test.hibernate.mocks.MockRegion.getName() returns null.
so, if the query cache enabled, the test throws NPE due to ConcurrentHashMap does not allow NULL key
from SessionFactoryImpl
allCacheRegions.put( updateTimestampsCache.getRegion().getName(), updateTimestampsCache.getRegion() );
NOTE: in real, hibernate will not build a cache region with a null name, so this bug only relates to the test, i will update MockRegion to give a region name.
- is related to
-
JBAS-8832 Upgrade to Hibernate 3.6.1.Final
- Closed