Harden the I18NFilter implementation for getLocale() and getLocales() methods
-----------------------------------------------------------------------------
Key: SLING-2107
URL: https://issues.apache.org/jira/browse/SLING-2107
Project: Sling
Issue Type: Bug
Components: Extensions
Affects Versions: I18n 2.0.4
Reporter: Felix Meschberger
Assignee: Felix Meschberger
Fix For: I18n 2.1.0
As per Toby's comment [1] to SLING-1905 we should harden the I18NFilter
implementations:
(1) We don't specify whether LocaleResolver.resolveLocale may return null or an
empty list.
==> we should specifiy this; IMHO allow null or empty list but defining
what the consequence would be
(2) I18NSlingHttpServletRequest.getLocaleList() does not check the result of
resolveLocale (which may be empty or null)
==> check the result of resolveLocale. If empty or null use singleton list
with the ResourceBundleProvider.getDefaultLocale()
(3) I18NSlingHttpServletRequest.getLocale() only checks for the empty list but
may throw NPE if the list is null
==> No need for check since getLocaleList() always returns non-empty list
(4) I18NSlingHttpServletRequest.getLocales() may in fact return an empty list
or even throw NPE if the list is null
==> No need for check since getLocaleList() always returns non-empty list
[1]
https://issues.apache.org/jira/browse/SLING-1905?focusedCommentId=13052839&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13052839
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira