-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adapt locales support for GraalVM >= 24.2 #43448
Conversation
db6b771
to
af4f16c
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Should we amend the doc in LocalesBuildTimeConfig
for defaultLocale
. It currently mentions:
quarkus.default-locale
Default locale that can be consumed by the extensions.
The locale must be specified in the IETF BCP 47 format e.g. en-US or fr-FR.
For instance, the Hibernate Validator extension makes use of it.
Native-image build uses this property to derive user.language and user.country for the application’s runtime.
Good point. I will update the doc and fix the style issue tomorrow. |
af4f16c
to
6b89856
Compare
Done, I also ended up moving the changes in |
core/runtime/src/main/java/io/quarkus/runtime/LocalesBuildTimeConfig.java
Outdated
Show resolved
Hide resolved
@@ -44,7 +44,8 @@ public class LocalesBuildTimeConfig { | |||
* For instance, the Hibernate Validator extension makes use of it. | |||
* <p> | |||
* Native-image build uses this property to derive {@code user.language} and {@code user.country} for the application's | |||
* runtime. | |||
* runtime. Starting with GraalVM for JDK 24 this option will not result in setting the default runtime locale, and | |||
* any usages of it should be re-evaluated. | |||
*/ | |||
@ConfigItem(defaultValue = DEFAULT_LANGUAGE + "-" + DEFAULT_COUNTRY, defaultValueDocumentation = "Build system locale") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defaultValueDocumentation
is:
- Build system locale (prior GraalVM for JDK 24)
- System default locale at image runtime with GraalVM for JDK 24 and better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- System default locale at image runtime with GraalVM for JDK 24 and better
Note that this is not enforced though, i.e., if we compile with -Dquarkus.default-locale=cs-CZ
we will still have to pass -Duser.language=cs
and/or -Duser.country=CZ
at runtime. Note that passing -Dquarkus.default-locale=cs-CZ
won't do the trick as it's considered build-time fixed, which I guess I need to fix as well.
I added a new test for this ^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gsmet any suggestions on how to approach this? To my understanding quarkus.default-locale
should move to RUN_TIME
config phase starting with GraalVM for JDK 24.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum, I'm not sure we have a good way to achieve that. We moved some build time properties to runtime but it was an all or nothing thing.
I think we will have to keep it build time until we officially switch to a GraalVM/Mandrel version that is 24+.
Except if @radcortez comes up with some crazy ideas but I'm not entirely sure it's worth the hassle if we can live with it for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mappings allow you to map the same property for both build and runtime. It can either be done by another mapping, or just by registering the LocalesBuildTimeConfig
in the runtime config customizer.
We had a similar case with logging:
#42157
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- System default locale at image runtime with GraalVM for JDK 24 and better
Note that this is not enforced though, i.e., if we compile with
-Dquarkus.default-locale=cs-CZ
we will still have to pass-Duser.language=cs
and/or-Duser.country=CZ
at runtime. Note that passing-Dquarkus.default-locale=cs-CZ
won't do the trick as it's considered build-time fixed, which I guess I need to fix as well.I added a new test for this ^
I'm not sure I follow. What I meant is that the native image follows the system locale at runtime. Yeah it's no longer build-time static (the default locale). For latest GraalVM master I see this. Test with Locale.getDefault()
in a native image.
On de-AT
locale:
$ localectl status
System Locale: LANG=de_AT.UTF-8
VC Keymap: us
X11 Layout: us
X11 Model: pc105
$ ./locale-test-24
Default locale: de_AT
On en-US
locale:
$ localectl status
System Locale: LANG=en_US.UTF-8
VC Keymap: us
X11 Layout: us
$ ./locale-test-24
Default locale: en_US
So with GraalVM for JDK 24, native images behave more like java
would.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly, which means that defaultLocale
currently has no effect at the native-image run-time locale starting with GraalVM for JDK 24 (other than including the locale in the image). I am starting to believe that the best thing to do is to print a warning saying that defaultLocale
is ignored (when using GraalVM for JDK 24) and deprecate it once GraalVM for JDK 25 is out.
I think adding the default locale to the list of included locales is still a good thing to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@radcortez I made defaultLocale
an Optional
and thus removed the defaultValue
from its annotation (in another commit hash), but that resulted in the following exception:
Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Set.contains(Object)" because "this.val$localesBuildTimeConfig.locales" is null
at io.quarkus.hibernate.validator.runtime.HibernateValidatorRecorder$2.created(HibernateValidatorRecorder.java:87)
at io.quarkus.arc.runtime.ArcRecorder.initBeanContainer(ArcRecorder.java:80)
at io.quarkus.deployment.steps.ArcProcessor$notifyBeanContainerListeners1304312071.deploy_0(Unknown Source)
at io.quarkus.deployment.steps.ArcProcessor$notifyBeanContainerListeners1304312071.deploy(Unknown Source)
... 42 more
See https://github.com/zakkak/quarkus/actions/runs/11203768674/job/31141630432#step:16:636
Note that the field it's complaining about is the locales
one (which I didn't change and I kept its defaultValue
) and not the defaultLocale
.
Is that expected behavior? Am I missing some configuration?
core/deployment/src/main/java/io/quarkus/deployment/steps/LocaleProcessor.java
Outdated
Show resolved
Hide resolved
integration-tests/locales/some/src/test/java/io/quarkus/locales/it/LocalesIT.java
Outdated
Show resolved
Hide resolved
core/deployment/src/main/java/io/quarkus/deployment/steps/LocaleProcessor.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spotted a typo in the config doc, other than that it looks good, thanks!
core/deployment/src/main/java/io/quarkus/deployment/pkg/NativeConfig.java
Outdated
Show resolved
Hide resolved
core/deployment/src/main/java/io/quarkus/deployment/pkg/NativeConfig.java
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx.
I'd add a test for 24.2 to see what happened with the "old" prop.
Other than that the only concern is Hibernate Validator and if it can handle that.
@@ -3,3 +3,4 @@ quarkus.locales=de,fr-FR,ja,uk-UA | |||
# used in your application properties. This test uses it only to verify compatibility. | |||
quarkus.native.user-language=cs | |||
quarkus.default-locale=en-US | |||
quarkus.test.arg-line=-Duser.language=de |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zakkak Does it mean the user language cs is ignored and should not be available in this case? Could you call https://github.com/quarkusio/quarkus/blob/main/integration-tests/locales/app/src/main/java/io/quarkus/locales/it/LocalesResource.java#L27 in > 24.2 test too then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, it'll be available since cs
is being added as an additional locale. The difference to Mandrel for JDK 23 is that you can no longer fix the default locale at build time. If you want a fixed locale the image needs -Duser.language=cs
passed at runtime to fix it to cs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, the cs
locale will be available but not the default at runtime and passing -Duser.language=
we can set any of the available locales as the default.
Can you elaborate on that? What is the "old" prop? I added (but didn't push yet) a new test to test the default locale when not using |
Sounds flaky, as it would depend on the system locale at runtime. |
Yes, in the "new" approach were the locale is set at run-time instead of build-time we will probably need to set the locale at build time to something really exotic and just confirm that it's not used by default at run-time. |
OK, fair enough. |
6b89856
to
818b953
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Minor nits. Feel free to take the suggestions or leave it as is. Up to you.
integration-tests/locales/default/src/test/java/io/quarkus/locales/it/LocalesIT.java
Outdated
Show resolved
Hide resolved
integration-tests/locales/default/src/test/java/io/quarkus/locales/it/LocalesIT.java
Outdated
Show resolved
Hide resolved
integration-tests/locales/default/src/test/java/io/quarkus/locales/it/LocalesIT.java
Outdated
Show resolved
Hide resolved
integration-tests/locales/some/src/test/java/io/quarkus/locales/it/LocalesIT.java
Outdated
Show resolved
Hide resolved
integration-tests/locales/some/src/test/java/io/quarkus/locales/it/LocalesIT.java
Outdated
Show resolved
Hide resolved
Thanks for the review @jerboaa! I (unsuccessfully) tried sticking to the existing naming convention. I will rename them if more changes are requested. |
Where are we with this? At the very least, it needs a rebase on |
*/ | ||
@ConfigItem(defaultValue = DEFAULT_LANGUAGE + "-" + DEFAULT_COUNTRY, defaultValueDocumentation = "Build system locale") | ||
public Locale defaultLocale; | ||
public Optional<Locale> defaultLocale; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You make it optional but you still have a defaultValue
set so I fail to see when it's going to be empty?
You're mentioning an Hibernate Validator issue but it looks like you fixed it? Maybe you forgot to drop it afterwards?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed with 0ea1c6b PTAL (I will squash once you are OK with the changes and CI passes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, you can remove the sentence starting with Defaults to...
in the main javadoc as the defaultValueDocumentation
will be printed in the doc.
Anyway, looks good to me. I let you squash things as you see fit and then we can merge!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand all the changes you made thus why I asked questions.
core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageFeatureStep.java
Outdated
Show resolved
Hide resolved
core/runtime/src/main/java/io/quarkus/runtime/LocalesBuildTimeConfig.java
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
0ea1c6b
to
d4a78de
Compare
This comment has been minimized.
This comment has been minimized.
*/ | ||
@ConfigItem(defaultValue = DEFAULT_LANGUAGE + "-" + DEFAULT_COUNTRY, defaultValueDocumentation = "Build system locale") | ||
public Locale defaultLocale; | ||
public Optional<Locale> defaultLocale; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, you can remove the sentence starting with Defaults to...
in the main javadoc as the defaultValueDocumentation
will be printed in the doc.
Anyway, looks good to me. I let you squash things as you see fit and then we can merge!
Yes, you can see them running here https://github.com/quarkusio/quarkus/actions/runs/11401583858/job/31725538105?pr=43448#step:16:2568 |
Starting with GraalVM for JDK 24 (24.2) native image will no longer set the locale default at build time. As a result, the default locale won't be included by default in the native image unless explicitly specified. As discussed in quarkusio#43533 (reply in thread) this patch updates the locales support so that: - if neither `quarkus.locales` nor `quarkus.default-locale` is set, the Quarkus applications should default to English (`en_US`), instead of the build systems locale (which is the current behavior), at run-time. - if `quarkus.default-locale` is set but `quarkus.locales` is not set, then we should only include the locale `quarkus.default-locale` is set to. This is the current behavior with GraalVM for JDK 21. - if both `quarkus.default-locale` and `quarkus.locales` are set, then we should include only the locales from `quarkus.locales` and the one from `quarkus.default-locale` (this is the current behavior). - if `quarkus.locales` is set but `quarkus.default-locale` is not set, then we should include only the locales from `quarkus.locales` and default to English, instead of the build systems locale (which is the current behavior), at run-time (similarly to point 1). - if `quarkus.default-locale` (which is build time fixed) is set, it is used to set the default `user.language` and `user.country` values at run-time, while users may still override them. For points 2 and 3 starting with graalVM for JDK 24 we also include `en_US` which shouldn't be a big issue as mentioned in quarkusio#43533 (reply in thread), CAUTION: Point 1 changes the current behavior, meaning we need to clearly document and communicate it. This patch also updates the Locales integration tests accordingly. See oracle/graal#9694
d4a78de
to
7f39ccc
Compare
Squashed and rebased. |
Status for workflow
|
Status | Name | Step | Failures | Logs | Raw logs | Build scan |
---|---|---|---|---|---|---|
✔️ | JVM Tests - JDK 17 | Logs | Raw logs | 🔍 | ||
✖ | JVM Tests - JDK 21 | Build |
Failures | Logs | Raw logs | 🔍 |
Full information is available in the Build summary check run.
You can consult the Develocity build scans.
Failures
⚙️ JVM Tests - JDK 21 #
- Failing: integration-tests/mongodb-devservices
📦 integration-tests/mongodb-devservices
✖ io.quarkus.it.mongodb.BookResourceTest.
- History - More details - Source on GitHub
java.lang.NullPointerException: Cannot invoke "io.quarkus.bootstrap.app.RunningQuarkusApplication.getClassLoader()" because "io.quarkus.test.junit.QuarkusTestExtension.runningQuarkusApplication" is null
at io.quarkus.test.junit.QuarkusTestExtension.runExtensionMethod(QuarkusTestExtension.java:909)
at io.quarkus.test.junit.QuarkusTestExtension.runExtensionMethod(QuarkusTestExtension.java:901)
at io.quarkus.test.junit.QuarkusTestExtension.interceptAfterAllMethod(QuarkusTestExtension.java:895)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1116)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Suppressed: org.opentest4j.TestAbortedException: Boot failed
✖ io.quarkus.it.mongodb.BookResourceWithParameterInjectionTest.
- History - More details - Source on GitHub
java.lang.RuntimeException:
java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.mongodb.deployment.DevServicesMongoProcessor#startMongo threw an exception: java.lang.RuntimeException: org.testcontainers.containers.ContainerFetchException: Can't get Docker image: RemoteDockerImage(imageName=docker.io/mongo:7.0, imagePullPolicy=DefaultPullPolicy(), imageNameSubstitutor=org.testcontainers.utility.ImageNameSubstitutor$LogWrappedImageNameSubstitutor@b3fad34)
at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.startMongo(DevServicesMongoProcessor.java:122)
at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856)
at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
✖ io.quarkus.it.mongodb.OtherProfileBookResourceTest.testBlockingClient
- History - More details - Source on GitHub
java.lang.RuntimeException:
java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.mongodb.deployment.DevServicesMongoProcessor#startMongo threw an exception: java.lang.RuntimeException: org.testcontainers.containers.ContainerFetchException: Can't get Docker image: RemoteDockerImage(imageName=docker.io/mongo:7.0, imagePullPolicy=DefaultPullPolicy(), imageNameSubstitutor=org.testcontainers.utility.ImageNameSubstitutor$LogWrappedImageNameSubstitutor@38cc61e6)
at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.startMongo(DevServicesMongoProcessor.java:122)
at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856)
at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
Flaky tests - Develocity
⚙️ JVM Tests - JDK 17
📦 extensions/smallrye-reactive-messaging/deployment
✖ io.quarkus.smallrye.reactivemessaging.hotreload.ConnectorChangeTest.testUpdatingConnector
- History
Expecting actual: ["-6","-8","-9","-10","-11","-12","-13","-14"] to start with: ["-6", "-7", "-8", "-9"]
-java.lang.AssertionError
java.lang.AssertionError:
Expecting actual:
["-6","-8","-9","-10","-11","-12","-13","-14"]
to start with:
["-6", "-7", "-8", "-9"]
at io.quarkus.smallrye.reactivemessaging.hotreload.ConnectorChangeTest.testUpdatingConnector(ConnectorChangeTest.java:41)
⚙️ JVM Tests - JDK 21
📦 extensions/infinispan-cache/deployment
✖ io.quarkus.cache.infinispan.InfinispanCacheTest.testGetAsyncWithParallelCalls
- History
expected: "thread1" but was: "thread2"
-org.opentest4j.AssertionFailedError
org.opentest4j.AssertionFailedError:
expected: "thread1"
but was: "thread2"
at io.quarkus.cache.infinispan.InfinispanCacheTest.testGetAsyncWithParallelCalls(InfinispanCacheTest.java:283)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at io.quarkus.test.QuarkusUnitTest.runExtensionMethod(QuarkusUnitTest.java:513)
at io.quarkus.test.QuarkusUnitTest.interceptTestMethod(QuarkusUnitTest.java:427)
📦 integration-tests/mongodb-panache
✖ io.quarkus.it.mongodb.panache.ReflectionFreeSerializationTest.testReactiveBookEntity
- History
com.fasterxml.jackson.databind.exc.MismatchedInputException: No content to map due to end-of-input at [Source: REDACTED (\
StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1]-
java.lang.RuntimeException`
java.lang.RuntimeException:
com.fasterxml.jackson.databind.exc.MismatchedInputException: No content to map due to end-of-input
at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1]
at io.restassured.internal.path.json.mapping.JsonPathJackson2ObjectDeserializer.deserialize(JsonPathJackson2ObjectDeserializer.java:30)
at io.restassured.path.json.mapping.JsonPathObjectDeserializer$deserialize.call(Unknown Source)
at io.restassured.internal.mapping.Jackson2Mapper.deserialize(Jackson2Mapper.groovy:58)
at io.restassured.mapper.ObjectMapper$deserialize.call(Unknown Source)
at io.restassured.internal.mapping.ObjectMapping.parseWithJackson2(ObjectMapping.groovy:254)
⚙️ Maven Tests - JDK 17 Windows
📦 integration-tests/maven
✖ io.quarkus.maven.it.TestMojoIT.testThatTheTestsAreReRunMultiModule
- History
Condition with Lambda expression in io.quarkus.maven.it.continuoustesting.TestModeContinuousTestingMavenTestUtils was not fulfilled within 3 minutes.
-org.awaitility.core.ConditionTimeoutException
org.awaitility.core.ConditionTimeoutException: Condition with Lambda expression in io.quarkus.maven.it.continuoustesting.TestModeContinuousTestingMavenTestUtils was not fulfilled within 3 minutes.
at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
at org.awaitility.core.CallableCondition.await(CallableCondition.java:78)
at org.awaitility.core.CallableCondition.await(CallableCondition.java:26)
at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:1006)
at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:975)
at io.quarkus.maven.it.continuoustesting.TestModeContinuousTestingMavenTestUtils.waitForNextCompletion(TestModeContinuousTestingMavenTestUtils.java:50)
at io.quarkus.maven.it.LaunchMojoTestBase.testThatTheTestsAreReRunMultiModule(LaunchMojoTestBase.java:56)
✖ io.quarkus.maven.it.TestMojoIT.testThatTheTestsAreReRunMultiModule
- History
Condition with Lambda expression in io.quarkus.maven.it.continuoustesting.TestModeContinuousTestingMavenTestUtils was not fulfilled within 3 minutes.
-org.awaitility.core.ConditionTimeoutException
org.awaitility.core.ConditionTimeoutException: Condition with Lambda expression in io.quarkus.maven.it.continuoustesting.TestModeContinuousTestingMavenTestUtils was not fulfilled within 3 minutes.
at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
at org.awaitility.core.CallableCondition.await(CallableCondition.java:78)
at org.awaitility.core.CallableCondition.await(CallableCondition.java:26)
at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:1006)
at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:975)
at io.quarkus.maven.it.continuoustesting.TestModeContinuousTestingMavenTestUtils.waitForNextCompletion(TestModeContinuousTestingMavenTestUtils.java:50)
at io.quarkus.maven.it.LaunchMojoTestBase.testThatTheTestsAreReRunMultiModule(LaunchMojoTestBase.java:56)
@karesti the @mariofusco I have also seen this |
FTR the change has been documented in the migration guide for 3.17 here https://github.com/quarkusio/quarkus/wiki/Migration-Guide-3.17#locales |
This is to solve an issue that we can see from time to time in the CI: java.lang.NullPointerException: Cannot invoke "io.quarkus.bootstrap.app.RunningQuarkusApplication.getClassLoader()" because "io.quarkus.test.junit.QuarkusTestExtension.runningQuarkusApplication" is null at io.quarkus.test.junit.QuarkusTestExtension.runExtensionMethod(QuarkusTestExtension.java:909) at io.quarkus.test.junit.QuarkusTestExtension.runExtensionMethod(QuarkusTestExtension.java:901) at io.quarkus.test.junit.QuarkusTestExtension.interceptAfterAllMethod(QuarkusTestExtension.java:895) at java.base/java.util.ArrayList.forEach(ArrayList.java:1596) at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1116) at java.base/java.util.ArrayList.forEach(ArrayList.java:1596) Suppressed: org.opentest4j.TestAbortedException: Boot failed For instance here: quarkusio#43448 (comment) in the io.quarkus.it.mongodb.BookResourceTest failure.
This is to solve an issue that we can see from time to time in the CI: java.lang.NullPointerException: Cannot invoke "io.quarkus.bootstrap.app.RunningQuarkusApplication.getClassLoader()" because "io.quarkus.test.junit.QuarkusTestExtension.runningQuarkusApplication" is null at io.quarkus.test.junit.QuarkusTestExtension.runExtensionMethod(QuarkusTestExtension.java:909) at io.quarkus.test.junit.QuarkusTestExtension.runExtensionMethod(QuarkusTestExtension.java:901) at io.quarkus.test.junit.QuarkusTestExtension.interceptAfterAllMethod(QuarkusTestExtension.java:895) at java.base/java.util.ArrayList.forEach(ArrayList.java:1596) at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1116) at java.base/java.util.ArrayList.forEach(ArrayList.java:1596) Suppressed: org.opentest4j.TestAbortedException: Boot failed For instance here: quarkusio#43448 (comment) in the io.quarkus.it.mongodb.BookResourceTest failure. (cherry picked from commit 96b0c2f)
This is to solve an issue that we can see from time to time in the CI: java.lang.NullPointerException: Cannot invoke "io.quarkus.bootstrap.app.RunningQuarkusApplication.getClassLoader()" because "io.quarkus.test.junit.QuarkusTestExtension.runningQuarkusApplication" is null at io.quarkus.test.junit.QuarkusTestExtension.runExtensionMethod(QuarkusTestExtension.java:909) at io.quarkus.test.junit.QuarkusTestExtension.runExtensionMethod(QuarkusTestExtension.java:901) at io.quarkus.test.junit.QuarkusTestExtension.interceptAfterAllMethod(QuarkusTestExtension.java:895) at java.base/java.util.ArrayList.forEach(ArrayList.java:1596) at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1116) at java.base/java.util.ArrayList.forEach(ArrayList.java:1596) Suppressed: org.opentest4j.TestAbortedException: Boot failed For instance here: quarkusio#43448 (comment) in the io.quarkus.it.mongodb.BookResourceTest failure.
Starting with GraalVM for JDK 24 (24.2) native image will no longer set the locale default at build time. As a result, the default locale won't be included by default in the native image unless explicitly specified and it will also not be set implicitly.
As discussed in #43533 (reply in thread) this PR updates the locales support so that:
quarkus.locales
norquarkus.default-locale
is set, the Quarkus applications should default to English (en_US
), instead of the build systems locale (which is the current behavior), at run-time.quarkus.default-locale
is set butquarkus.locales
is not set, then we should only include the localequarkus.default-locale
is set to. This is the current behavior with GraalVM for JDK 21.quarkus.default-locale
andquarkus.locales
are set, then we should include only the locales fromquarkus.locales
and the one fromquarkus.default-locale
(this is the current behavior).quarkus.locales
is set butquarkus.default-locale
is not set, then we should include only the locales fromquarkus.locales
and default to English, instead of the build systems locale (which is the current behavior), at run-time (similarly to point 1).quarkus.default-locale
(which is build time fixed) is set, it is used to set the defaultuser.language
anduser.country
values at run-time, while users may still override them.For points 2 and 3 starting with graalVM for JDK 24 we will also include
en_US
which shouldn't be a big issue as mentioned in #43533 (reply in thread),Caution
Point 1 changes the current behavior, meaning we need to clearly document and communicate it.
The PR also updates the Locales integration tests accordingly.
See oracle/graal#9694
Closes #43436
Depends on #43696