[java-shib-shared] branch main updated: JSE-50 4.2.1 throws an unhandled exception when Locale set to C.UTF-8
Rod Widdowson
rdw at steadingsoftware.com
Tue Oct 25 09:42:19 UTC 2022
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch main
in repository java-shib-shared.
View the commit online:
http://git.shibboleth.net/view/?p=java-shib-shared.git;a=commit;h=dd08ae49984d173c4892c885fb69f3b2cebd5d07
The following commit(s) were added to refs/heads/main by this push:
new dd08ae49 JSE-50 4.2.1 throws an unhandled exception when Locale set to C.UTF-8
dd08ae49 is described below
commit dd08ae49984d173c4892c885fb69f3b2cebd5d07
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Mon Oct 24 16:37:13 2022 +0100
JSE-50 4.2.1 throws an unhandled exception when Locale set to C.UTF-8
https://shibboleth.atlassian.net/browse/JSE-50
Catch the error and log it instead.
---
.../net/shibboleth/shared/spring/util/SpringSupport.java | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/util/SpringSupport.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/util/SpringSupport.java
index 0e97aba6..3e2a2234 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/util/SpringSupport.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/util/SpringSupport.java
@@ -22,6 +22,7 @@ import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.Locale;
import java.util.Locale.LanguageRange;
import javax.annotation.Nonnull;
@@ -336,7 +337,16 @@ public final class SpringSupport {
final List<LanguageRange> fromBrowser = HttpServletSupport.getLanguageRange(request);
final List<LanguageRange> outList = new ArrayList<>(1+fromBrowser.size());
- outList.add(new LanguageRange(RequestContextUtils.getLocale(request).getLanguage()));
+ final Locale locale = RequestContextUtils.getLocale(request);
+ if (locale == null) {
+ LOG.error("Spring returned a null locale");
+ } else {
+ try {
+ outList.add(new LanguageRange(locale.getLanguage()));
+ } catch (final Throwable t) {
+ LOG.error("Could not create LanguageRange for {}, Ignoring", locale, t);
+ }
+ }
outList.addAll(fromBrowser);
return List.copyOf(outList);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list