CacheableFileXmlSource.doBind returns null instead of created binding when .hbm.xml.bin have not been created yet

Description

Using MetadataSources.addCacheableFile with a .hbm.xml file that exists but without a .hbm.xml.bin file (not created yet at this point) results in a null binding because of https://github.com/hibernate/hibernate-orm/blob/5.0.1.Final/hibernate-core/src/main/java/org/hibernate/boot/jaxb/internal/CacheableFileXmlSource.java#L98. In the end it results in a NPE:

java.lang.NullPointerException at org.hibernate.boot.model.source.internal.hbm.HbmMetadataSourceProcessorImpl.<init>(HbmMetadataSourceProcessorImpl.java:53) at org.hibernate.boot.model.source.internal.hbm.HbmMetadataSourceProcessorImpl.<init>(HbmMetadataSourceProcessorImpl.java:40) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.<init>(MetadataBuildingProcess.java:142) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:141) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83) at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418) at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87) at org.hibernate.boot.MetadataSources.buildMetadata(MetadataSources.java:179)

Instead, I think that the binding should be returned after having been serialized (now the .hbm.xml.bin file exists). That is, "return binding" after https://github.com/hibernate/hibernate-orm/blob/5.0.1.Final/hibernate-core/src/main/java/org/hibernate/boot/jaxb/internal/CacheableFileXmlSource.java#L95.

I have attached a patch that seems to fix the problem for me.

Attachments

1
  • 25 Sep 2015, 10:13 AM

Activity

Show:
Steve Ebersole
changed the StatusSeptember 30, 2015 at 6:35 PM
Resolved
Closed
Steve Ebersole
changed the StatusSeptember 25, 2015 at 5:26 PM
In Progress
Resolved
Steve Ebersole
updated the Fix versionsSeptember 25, 2015 at 5:26 PM
None
5.0.2
Steve Ebersole
updated the ResolutionSeptember 25, 2015 at 5:26 PM
None
Fixed
Steve Ebersole
updated the WorklogIdSeptember 25, 2015 at 5:26 PM
31911
None
Steve Ebersole
updated the Time SpentSeptember 25, 2015 at 5:26 PM
0h
0.98h
Steve Ebersole
changed the StatusSeptember 25, 2015 at 4:27 PM
Open
In Progress
Steve Ebersole
changed the AssigneeSeptember 25, 2015 at 4:27 PM
Unassigned
Steve Ebersole
Martin Kamp Jensen
created the IssueSeptember 25, 2015 at 10:16 AM
Fixed

Details

Assignee

Steve Ebersole

Reporter

Time tracking

0.98h logged

Components

Fix versions

Affects versions

Priority

Created September 25, 2015 at 10:16 AM
Updated September 30, 2015 at 6:35 PM
Resolved September 25, 2015 at 5:26 PM