Skip to content

XML configuration tests fail with a non-English locale #19725

Description

@noojung

Describe the bug

Three tests in spring-security-config assert on the text of XML schema validation errors produced by the JDK's built-in Xerces. Those messages are localized by the JDK, so the tests fails whenever the build runs with a non-English default locale.

    JdbcUserServiceBeanDefinitionParserTests > testMissingDataSourceRef() FAILED
    HttpHeadersConfigTests > configureWhenUsingHpkpWithoutPinsThenAutowireFails() FAILED
    HttpHeadersConfigTests > configureWhenUsingHpkpWithEmptyPinsThenAutowireFails() FAILED

    3661 tests completed, 3 failed, 6 skipped

The exception-type assertions pass; only the message comparison fails:

    en_US  cvc-complex-type.4: Attribute 'data-source-ref' must appear on element 'jdbc-user-service'.
    ko_KR  cvc-complex-type.4: 'data-source-ref' 속성은 'jdbc-user-service' 요소에 나타나야 합니다.
    ja_JP  cvc-complex-type.4: 要素'jdbc-user-service'に属性'data-source-ref'が必要です。

To Reproduce

You can easily reproduce this by forcing a non-English locale in your terminal using JAVA_TOOL_OPTIONS:

JAVA_TOOL_OPTIONS="-Duser.language=ko -Duser.country=KR" \
./gradlew :spring-security-config:test \
  --rerun-tasks --no-build-cache

Gradle propagates user.language/user.country from the daemon to test workers, so this reproduces regardless of the host machine's locale.

Environment

JDK 25 (Temurin 25.0.4), Gradle 9.7.1, macOS 15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions