Details

Description

They have a mutable static field cachedResources which is used in performing translations.

If two threads use different locales - which is highly likely in the case of non-US locales, as some methods use Locale.US - then they may get corrupt or incorrect output.

If a cache is really desired, it could either be ThreadLocal, or volatile, but it that case the translate method needs to fetch the value once (and update it once if necessary).

As it stands, the method can check the resource, find it is OK, then fetch it again to use it, by which time it might have changed. Further, one thread may set the variable, and another thread may see a partially constructed Resources object (it's not final).