Skip to content

Avoid accessing ThreadLocal#13959

Draft
mkurz wants to merge 1 commit into
playframework:mainfrom
mkurz:avoid_spring_threadlocal
Draft

Avoid accessing ThreadLocal#13959
mkurz wants to merge 1 commit into
playframework:mainfrom
mkurz:avoid_spring_threadlocal

Conversation

@mkurz
Copy link
Copy Markdown
Member

@mkurz mkurz commented May 28, 2026

Covered by following test:

"have the validator translate error messages correctly" in new WithApplication(
application("play.i18n.langs" -> List("de", "en", "ja"))
) {
override def running() = {
val myFormJa = formFactory
.form(classOf[JavaI18NValidatorForm])
.bind(new Lang(Locale.JAPANESE), TypedMap.empty(), Map("note" -> "foo").asJava)
myFormJa.errors("note").get(0).message() must beEqualTo("10 から 100 の間のサイズにしてください")
val myFormEn = formFactory
.form(classOf[JavaI18NValidatorForm])
.bind(new Lang(Locale.ENGLISH), TypedMap.empty(), Map("note" -> "foo").asJava)
myFormEn.errors("note").get(0).message() must beEqualTo("size must be between 10 and 100")
val myFormDe = formFactory
.form(classOf[JavaI18NValidatorForm])
.bind(new Lang(Locale.GERMAN), TypedMap.empty(), Map("note" -> "foo").asJava)
myFormDe.errors("note").get(0).message() must beEqualTo("Größe muss zwischen 10 und 100 sein")
// French not defined in config, fall back to default (which is german, since it is first in the list)
val myFormFr = formFactory
.form(classOf[JavaI18NValidatorForm])
.bind(new Lang(Locale.FRENCH), TypedMap.empty(), Map("note" -> "foo").asJava)
myFormFr.errors("note").get(0).message() must beEqualTo("Größe muss zwischen 10 und 100 sein")
}

@mkurz mkurz marked this pull request as draft May 28, 2026 14:37
Covered by test "have the validator translate error messages correctly"
in FormSpec.scala
@mkurz mkurz force-pushed the avoid_spring_threadlocal branch from 1d9ca8d to ee8c6b0 Compare May 29, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant