FULL PRODUCT VERSION :
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
Caching implemented in ResourceBundle (line 1328) causes that the wrong text is retrieved when caching applies for the special case no_NO_NY.
The candidate Locales for no_NO_NY are:
nn_NO
nn
no_NO_NY
no_NO
no
However, once the bundle for no_NO_NY is cached, then no longer a text from nn_NO is used but the one from no_NO_NY straight away.
Most likely this has not caused any harm so far, since it is more of a theoretical Problem (one most probably does not define e.g. a properties file for both nn_NO and no_NO_NY).
Nevertheless, IMO it should be a documented behaviour.
As consequence, I do no longer support no neither no_NO in my application.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- create a bundle for nn_NO and one for no_NO_NY
- search for a corresponding property which exists in nn_NO => translation of nn_NO is returned
- search for it a second time => translation of no_NO_NY is returned
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
translation of nn_NO is returned twice
ACTUAL -
translation of no_NO_NY is returned
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Only define one properties file