From ed2a8967b1627e52ca4eccaabf932751ce27f4c8 Mon Sep 17 00:00:00 2001 From: Michal Karm Babacek Date: Wed, 22 Nov 2023 01:13:42 +0100 Subject: [PATCH] Hibernate validator interprets Locale.ROOT as array of all --- .../validator/runtime/HibernateValidatorRecorder.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/extensions/hibernate-validator/runtime/src/main/java/io/quarkus/hibernate/validator/runtime/HibernateValidatorRecorder.java b/extensions/hibernate-validator/runtime/src/main/java/io/quarkus/hibernate/validator/runtime/HibernateValidatorRecorder.java index 5888318baae13..88b808fd14142 100644 --- a/extensions/hibernate-validator/runtime/src/main/java/io/quarkus/hibernate/validator/runtime/HibernateValidatorRecorder.java +++ b/extensions/hibernate-validator/runtime/src/main/java/io/quarkus/hibernate/validator/runtime/HibernateValidatorRecorder.java @@ -3,6 +3,7 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Set; import java.util.function.Supplier; @@ -75,10 +76,11 @@ public void created(BeanContainer container) { configuration.localeResolver(localeResolver); } - configuration - .builtinConstraints(detectedBuiltinConstraints) + configuration.builtinConstraints(detectedBuiltinConstraints) .initializeBeanMetaData(classesToBeValidated) - .locales(localesBuildTimeConfig.locales) + // Locales, Locale ROOT means all locales in this setting. + .locales(localesBuildTimeConfig.locales.contains(Locale.ROOT) ? Set.of(Locale.getAvailableLocales()) + : localesBuildTimeConfig.locales) .defaultLocale(localesBuildTimeConfig.defaultLocale) .beanMetaDataClassNormalizer(new ArcProxyBeanMetaDataClassNormalizer());