CacheableFileXmlSource.doBind returns null instead of created binding when .hbm.xml.bin have not been created yet
Description
Attachments
1
- 25 Sep 2015, 10:13 AM
Activity
Show:
Steve Ebersole
changed the StatusSeptember 30, 2015 at 6:35 PMResolved
Closed
Steve Ebersole
changed the StatusSeptember 25, 2015 at 5:26 PMIn Progress
Resolved
Steve Ebersole
updated the Fix versionsSeptember 25, 2015 at 5:26 PMNone
5.0.2
Steve Ebersole
updated the ResolutionSeptember 25, 2015 at 5:26 PMNone
Fixed
Steve Ebersole
updated the WorklogIdSeptember 25, 2015 at 5:26 PM31911
None
Steve Ebersole
updated the Time SpentSeptember 25, 2015 at 5:26 PM0h
0.98h
Steve Ebersole
changed the StatusSeptember 25, 2015 at 4:27 PMOpen
In Progress
Steve Ebersole
changed the AssigneeSeptember 25, 2015 at 4:27 PMUnassigned
Steve Ebersole
Martin Kamp Jensen
created the IssueSeptember 25, 2015 at 10:16 AMFixed
Details
Assignee
Reporter
Martin Kamp Jensen
Martin Kamp JensenTime tracking
0.98h logged
Components
Fix versions
Affects versions
Priority
Major
Created September 25, 2015 at 10:16 AM
Updated September 30, 2015 at 6:35 PM
Resolved September 25, 2015 at 5:26 PM
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.