Binder#bindIdentifierGenerator leads to NPE due to bad Map calls

Description

http://pastie.org/9196859 is a NPE that occurs when the CDI BeanManager
is accessed during the first (EntityManagerFactoryBuilder) phase.
Hibernate ORM shouldn't use the BeanManager until the second bootstrap phase.

Links to git integration efforts to bring Hibernate 5.x into WildFly 9:
https://github.com/scottmarlow/wildfly/tree/hibernate5
https://github.com/scottmarlow/jipijapa/tree/JIPI-31

Environment

None

Activity

Show:
Scott Marlow
June 3, 2014, 2:23 PM

This issue is blocking me from making progress with integrating Hibernate 5.x into WildFly 9.x

Steve Ebersole
July 1, 2014, 8:36 PM

Scott, what makes you think this is related to CDI? Unless the lines have changed significantly, that stack trace simply shows a NPE trying to access the Map of properties. I have seen cases of that being null before; I thought I had addressed those though. Moreover, that entire method has no code attempting to access the BeanManager.

Scott Marlow
July 2, 2014, 1:53 AM

Hmm, my mistake, looks like a simple bug trying to access all of the values in the Map. One of the values happens to be the org.jboss.weld.util.ForwardingBeanManager which delegates to the CDI BeanManager later. I think that Binder.bindIdentifierGenerator() should use containsKey().

Caused by: java.lang.NullPointerException
at org.jboss.weld.util.ForwardingBeanManager.equals(ForwardingBeanManager.java:250)
at java.util.Hashtable.contains(Hashtable.java:371) [rt.jar:1.7.0_51]
at org.hibernate.metamodel.internal.binder.Binder.bindIdentifierGenerator(Binder.java:1327)

Assignee

Steve Ebersole

Reporter

Scott Marlow

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Blocker
Configure