[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5703) EJB3PostLoadEventListener, as created by EventListenerConfigurator, throws NullPointerException.
Eduardo Born (JIRA)
noreply at atlassian.com
Sat Oct 30 17:38:47 EDT 2010
EJB3PostLoadEventListener, as created by EventListenerConfigurator, throws NullPointerException.
------------------------------------------------------------------------------------------------
Key: HHH-5703
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5703
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.6
Reporter: Eduardo Born
EJB3PostLoadEventListener is created by EventListenerConfigurator with its default constructor:
listenerConfig.setPostLoadEventListeners(
new PostLoadEventListener[] { new EJB3PostLoadEventListener(), new DefaultPostLoadEventListener() }
);
The problem is that it has a callbackHandler field called which remains null, and there is no check in the postLoad method before invoking callbackHandler.postLoad( entity );. This causes a NullPointerException to be thrown there in a few situations.
The fix is simple. H+In the EJB3PostLoadEventListener's postLoad() method, replace:
public void onPostLoad(PostLoadEvent event) {
Object entity = event.getEntity();
callbackHandler.postLoad( entity );
}
by:
public void onPostLoad(PostLoadEvent event) {
if (callbackHandler == null) return;
Object entity = event.getEntity();
callbackHandler.postLoad( entity );
}
This would prevent the NullPointerException to be thrown when there is no callbackHandler.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list