spring-projects / spring-projects/spring-security

XML configuration tests fail with a non-English locale

Open Beginner friendly
#19,725 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage type: bug
Dominant language
Java
Stars
9.6k
Forks
6.3k
Avg merge
2d 11h
Merged PRs (30d)
52

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the three failing tests in spring-security-config: JdbcUserServiceBeanDefinitionParserTests.testMissingDataSourceRef() and the two HttpHeadersConfigTests HPKP cases. Run the provided JAVA_TOOL_OPTIONS locale reproduction, then inspect how each assertion compares the XML validation error. Done means the tests pass under the Korean or Japanese locale while retaining the exception-type checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.