7.0.X, 7.1.X, 7.2.X, 7.3.X, Master
Each time there's no key on _languageMaps we invoke _loadLocale. This two step process in suitable for a race condition since it isn't atomic.
Besides, the LanguageUtil.fromLanguageId isn't consistent, because when called without validation the languageId tested is added to the locales map. This causes a different behavior depending on the execution order:
Assume a hook is created with Language_en.properties as language file and en_US defined as an available locale, then
- If en hasn't been checked as super locale and added to the locales map en will not be returned as a valid locale from LanguageUtil.fromLanguageId and the ResourceBundle for Language_en.properties will not be registered
- If en has been checked as super locale and added to the locales map then en will be returned as valid locale and the ResourceBundle for Language_en.properties will be registered.
A possible way to reproduce it is (it may take several retries/restarts to reproduce the issue):
- Deploy a language hook created as war following steps like the ones listed in https://help.liferay.com/hc/es/articles/360018181091-Overriding-Language-Properties-Using-a-Hook using a file like Language_en.properties
- Restart the portal.
- Check if key overridden has been applied.