ContributorValidationMessages compatible with UTF-8 properties



In our (french language) project, we use bean validation with spring, we have different applications with a common library, we need to use in each application in addition of a common

ContributorValidationMessages mechanism works (nearly) great without configuration, our messages was resolved, but accented characters are not properly loaded. Our both and are in UTF-8, no problem with accented characters in the

After debug step by step the Hibernate Validation framework, I detected the loading between two properties files are different in method org.hibernate.validator.resourceloading.PlatformResourceBundleLocator.loadBundle.
We can see ValidationMessages (with false aggregate parameter) is loaded by default control in ResourceBundle.getBundle, but for ContributorValidationMessages with aggregate true, the properties is loaded by specific control org.hibernate.validator.resourceloading.PlatformResourceBundleLocator.AggregateResourceBundleControl

Technically ContributorValidationMessages are loaded by old style (before Java 9) java.util.Properties.load only compatible with ISO format, while ValidationMessages are loaded by new style (start with Java 9) java.util.PropertyResourceBundle.PropertyResourceBundle compatible with UTF-8 (default) and ISO.

I propose a fix in PR to modifiy org.hibernate.validator.resourceloading.PlatformResourceBundleLocator.AggregateResourceBundleControl

I remain at your disposal for any suggestion to improve code.
I will appreciate to contribute to the improvement of Hibernate Validation.





Jonathan Pepin
January 18, 2021, 6:35 PM

Thanks for your feedback Guillaume,

I made a particular attention to have a code perfectly compatible with java 8 and don’t use specfic API of Java 9+.

The difference will be only when you use Java 9+, you benefit of the improvement of java.util.PropertyResourceBundle.PropertyResourceBundle new implementation with UTF-8 compatibility.

So my proposal it’s an alignment to have same behaviour with (UTF-8 compatible with a runtime Java 9+).

And for Java 8, same behaviour as today for


Exemple of different PropertyResourceBundle implementation in JDK between Java 8 and Java 11

(Properties.load is only ISO compatible)

Javadoc about PropertyResourceBundle default loading in UTF-8 starting from Java 9

Guillaume Smet
January 18, 2021, 6:20 PM


Thanks for this work. An important point though is that Hibernate Validator is still compatible with JDK 8 so we cannot use JDK 9+ only APIs.




Jonathan Pepin