BUG: Hibernate-core-5.3.6-Final org.hibernate.tool.schema.internal.SchemaCreatorImpl.applyImportSources


#1

When import files is empty string,
line 484, no check for importFiles to be empty, this leads to a ScriptSourceInput pointing on a folder of which content will be listed in the generated DDL (on this machine ~ /Library/Java/Extensions/driver/)

NB
And if org.hibernate.cfg.AvailableSettings.HBM2DDL_IMPORT_FILES is not set to empty then import.sql is automatically added which is not intended in a DDL.
(setting it to null generates a NPE)

Current workaround it to set it to an empty file.


#2

If you think you found a bug, you need to replicate it using a test case. Afterward, you should open a Jira issue for it.


#3

HHH-13089
and NO I will not create a test case for that, since I report the exact line where the (trivial) problem occurs.


#4

Could not replicate it. Try to change this test case and prove that something is not working as expected.


#5

This is just demonstrating that the behavior of classLoaderService.locateResource( resourceName ) when resourceName is an empty string is platform-dependent, here obviously it is returning a folder URL and when a input stream is later opened on it, it returns the directory content.

Not calling that code when the resourceName string is empty at line 485 will fix the problem.


#6

Not calling that code when the resourceName string is empty at line 485 will fix the problem.

It’s already done. I’m not sure what you are talking about.


#7

The code you point on is 3.2.

5.3.6.Final branch on
[https://github.com/hibernate/hibernate-orm/blob/5.3.6/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/SchemaCreatorImpl.java]

same in 5.3.7.Final one
https://github.com/hibernate/hibernate-orm/blob/5.3.7/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/SchemaCreatorImpl.java
NO test on resourceName after the split…


#8

Nope. The code I pointed out is the master branch, meaning that the check if there. So, the issue was fixed and it’s unlikely that it will be backported to 5.3.

However, you can use 5.4 as it will be released soon.