[ https://issues.apache.org/jira/browse/SLING-6185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15604798#comment-15604798 ]
Timothee Maret edited comment on SLING-6185 at 10/25/16 9:54 AM: ----------------------------------------------------------------- [~cziegeler] I suggest to fix this by 1. Clarifying that {{org.apache.sling.i18n.ResourceBundleProvider#getDefaultLocale}} must not return null and ; 2. Fixing {{CombinedBundleProvider#getDefaultLocale}} such that it returns {{Locale.ENGLISH}} as fallback This would require changing the unit tests {{ResourceBundleProviderIT}} which cover returning {{null}} in some cases. Alternatively, we could 1. Clarify that {{org.apache.sling.i18n.ResourceBundleProvider#getDefaultLocale}} _may_ return null and ; 2. Fixing {{I18NHttpServletRequest#getLocaleList}} such that it returns {{Locale.ENGLISH}} as fallback when ResourceBundleProvider#getDefaultLocale returns {{null}}, and we keep the tests as is. wdyt ? was (Author: marett): [~cziegeler] I suggest to fix this by 1. Clarifying that {{org.apache.sling.i18n.ResourceBundleProvider#getDefaultLocale}} must not return null and ; 2. Fixing {{CombinedBundleProvider#getDefaultLocale}} such that it returns {{Locale.ENGLISH}} as fallback wdyt ? > I18NHttpServletRequest#getLocale should never return null > --------------------------------------------------------- > > Key: SLING-6185 > URL: https://issues.apache.org/jira/browse/SLING-6185 > Project: Sling > Issue Type: Bug > Components: i18n > Affects Versions: i18n 2.5.4 > Reporter: Timothee Maret > Assignee: Timothee Maret > > According to the JEE API, the {{ServletRequest#getLocale}} should never > return {{null}}, the ultimate fallback being the default locale for the > server. > However, the Sling wrapper > {{o.a.s.i.i.I18NFilter.I18NHttpServletRequest#getLocale}} _may_ return > {{null}} in case: > 1. the localeResolver does return {{empty list}} (allowed as per API) > 2. {{The bundleProvider#getDefaultLocale}} returns {{null}} (not clear if > allowed or not) > With the current Sling code, 2. can occurs at > https://github.com/apache/sling/blob/trunk/bundles/extensions/i18n/src/main/java/org/apache/sling/i18n/impl/I18NFilter.java#L198 > [0] > https://github.com/apache/sling/blob/trunk/bundles/extensions/i18n/src/main/java/org/apache/sling/i18n/impl/I18NFilter.java#L280-L283 -- This message was sent by Atlassian JIRA (v6.3.4#6332)