Merge pull request #416 from JCgH4164838Gh792C124B5/Partial_Backport_LL_tiny-improvements

Partial backport of Tiny improvements PR#414 to 2.5.x:
This commit is contained in:
Lukasz Lenart
2020-05-17 08:58:49 +02:00
committed by GitHub
@@ -696,12 +696,23 @@ public class Dispatcher {
try {
locale = LocaleUtils.toLocale(defaultLocale);
} catch (IllegalArgumentException e) {
LOG.warn(new ParameterizedMessage("Cannot convert 'struts.locale' = [{}] to proper locale, defaulting to request locale [{}]",
defaultLocale, request.getLocale()), e);
locale = request.getLocale();
try {
locale = request.getLocale();
LOG.warn(new ParameterizedMessage("Cannot convert 'struts.locale' = [{}] to proper locale, defaulting to request locale [{}]",
defaultLocale, locale), e);
} catch (RuntimeException rex) {
LOG.warn(new ParameterizedMessage("Cannot convert 'struts.locale' = [{}] to proper locale, and cannot get locale from HTTP Request, falling back to system default locale",
defaultLocale), rex);
locale = Locale.getDefault();
}
}
} else {
locale = request.getLocale();
try {
locale = request.getLocale();
} catch (RuntimeException rex) {
LOG.warn("Cannot get locale from HTTP Request, falling back to system default locale", rex);
locale = Locale.getDefault();
}
}
return locale;
}