Exception if spaces after value of javax.persistence.schema-generation.scripts.action in hibernate.properties

Description

I have been using version 5.3 (and it has the same issue).
If in hibernate config file, in version 5.3, I put an space after the 'hibernate.hbm2ddl.auto' value, e.g. 'create ' it throws an exception: IllegalArgumentException: "Unrecognized legacy `hibernate.hbm2ddl.auto` value : create).

I saw that in the master version, it was resolved with a trim():
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/tool/schema/Action.java line 153

But, if I try to use a property to generate schema files within the hibernate property config:
javax.persistence.schema-generation.scripts.action and the value has a space: 'drop-and-create ', it keeps throwing the exception.

The solution is very simple: add also a trim() in line 104 for interpretJpaSetting function , not only to interpretHbm2ddlSetting function :
final String name = value.toString().trim();

Environment

None

Status

Assignee

Andrea Boriero

Reporter

Alejandro Anadon

Fix versions

backPortable

Backport?

Suitable for new contributors

Yes, likely

Requires Release Note

None

Pull Request

None

backportDecision

None

Feedback Requested

2019/09/20

Components

Affects versions

Priority

Major
Configure