spring-projects / spring-projects/spring-security
XML configuration tests fail with a non-English locale
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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