Rejected
Details
Assignee
UnassignedUnassignedReporter
Eduardo BornEduardo BornComponents
Affects versions
Priority
Major
Details
Details
Assignee
Unassigned
UnassignedReporter
Eduardo Born
Eduardo BornComponents
Affects versions
Priority
Created October 30, 2010 at 11:37 PM
Updated July 8, 2014 at 3:10 PM
Resolved July 8, 2014 at 3:10 PM
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.