Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-38331

I18nResolver strips whitespace from properties and breaks completely when loading empty strings

    XMLWordPrintable

Details

    Description

      We're having major problems with I18nResolver under 6.2.5. Everything was previously tested and working perfectly under 6.2.2.

      This is effectively an API-breaking change that breaks a lot of the language text in our previously-released plugins, so now our UI is in shambles!

      The two problems we have encountered so far:

      1) Empty strings in the .properties file do not get resolved at all and it simply returns the key back. If I have a properties entry like this:

      foo.bar=
      

      Then 'i18nResolver.getText("foo.bar")' returns "foo.bar" in 6.2.5. It correctly returned "" in 6.2.2.

      2) Trailing spaces are being stripped from property entries. If we have a property entry like this:

      abc.def=Hello\u0020
      

      (using the proper Unicode format for a trailing space, as shown above) then i18nResolver would return "Hello " in JIRA 6.2.2 but merely "Hello" in 6.2.5.

      In PluginResourceLoaderInvocation:

          private Map<String, String> flattenResourceBundlesToMap(Iterable<ResourceBundle> bundles)
          {
      [...]
                             final String value = stripToNull(bundle.getString(propertyKey));
                              if (value != null)
                              {
                                  map.put(key.intern(), value.intern());
                              }
      

      The call to Apache Commons stripToNull deletes all of the leading and trailing whitespace (bug #2). It also replaces empty strings with nulls. Then the conditional decides not to add the string at all if it's null (bug #1).

      The above class is annotated as being new as of 6.2.3, but we didn't have a chance to test 6.2.3 or 6.2.4. If you think it's a problem there too, feel free to adjust the Affects Versions.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              7c60ab039b09 Scott Dudley [Inactive]
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: