Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-6185

I18NHttpServletRequest#getLocale should never return null

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • i18n 2.5.4
    • i18n 2.5.6
    • i18n
    • None
    • Patch

    Description

      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

      Attachments

        1. SLING-6185.patch
          2 kB
          Timothee Maret

        Activity

          People

            marett Timothee Maret
            marett Timothee Maret
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: