You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2020/05/11 12:55:56 UTC
[struts] 01/02: Fixes a problem with missing locale if
HttpServletRequest#getLocale throws exception
This is an automated email from the ASF dual-hosted git repository.
lukaszlenart pushed a commit to branch tiny-improvments
in repository https://gitbox.apache.org/repos/asf/struts.git
commit 28bc351e31d396face13a84edaf0d8ecb8d237e2
Author: Lukasz Lenart <lu...@apache.org>
AuthorDate: Mon May 11 14:55:35 2020 +0200
Fixes a problem with missing locale if HttpServletRequest#getLocale throws exception
---
core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
index b2951ad..efd1090 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
@@ -758,7 +758,12 @@ public class Dispatcher {
locale = request.getLocale();
}
} else {
- locale = request.getLocale();
+ try {
+ locale = request.getLocale();
+ } catch (RuntimeException e) {
+ LOG.warn("Cannot get locale from Http Request, falling back to system default locale", e);
+ locale = Locale.getDefault();
+ }
}
return locale;
}