Merge pull request #416 from JCgH4164838Gh792C124B5/Partial_Backport_LL_tiny-improvements

Partial backport of Tiny improvements PR#414 to 2.5.x:

(cherry picked from commit 3d3512a399)

# Conflicts:
#	core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java

Merge conflict manually resolved.
This commit is contained in:
JCgH4164838Gh792C124B5
2020-05-18 13:18:49 -04:00
parent 677f769bb7
commit efde28788e
@@ -753,15 +753,21 @@ 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 {
try {
locale = request.getLocale();
} catch (RuntimeException e) {
LOG.warn("Cannot get locale from Http Request, falling back to system default locale", e);
} catch (RuntimeException rex) {
LOG.warn("Cannot get locale from HTTP Request, falling back to system default locale", rex);
locale = Locale.getDefault();
}
}