https://bz.apache.org/bugzilla/show_bug.cgi?id=66207

            Bug ID: 66207
           Summary: StringManager#getManager(String,
                    Enumeration<java.util.Locale>) cannot return the
                    correct value
           Product: Tomcat 10
           Version: unspecified
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Util
          Assignee: dev@tomcat.apache.org
          Reporter: aooo...@gmail.com
  Target Milestone: ------

The reason for the problem is that when the StringManager object is created,
there is a special handling where the locale is specified as ROOT when the
language of the Local is English, and finally the local of the current sm
object is set to Locale.ENGLISH.
Code snippet.
```
if (locale.getLanguage().equals(Locale.ENGLISH.getLanguage())) {
   locale = Locale.ROOT;
}

.....

Locale bundleLocale = bundle.getLocale();
if (bundleLocale.equals(Locale.ROOT)) {
    this.locale = Locale.ENGLISH;
} else {
    this.locale = bundleLocale;
}

```
org.apache.tomcat.util.res.StringManager#getManager(java.lang.String,
java.util.Enumeration<java.util.Locale>) 
There is a local comparison in this method, if it is compared with If it is the
same as the local passed in then return it, otherwise get the default local sm.
```
StringManager result = getManager(packageName, locale);
if (result.getLocale().equals(locale)) {
    return result;
}
return getManager(packageName);
```

The problem lies in the comparison, which I think should be a comparison of
languages, not local objects, because Local(en) ! = Local(en-US)

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to