You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2022/08/11 15:19:53 UTC
[Bug 66207] New: StringManager#getManager(String, Enumeration) cannot return the correct value
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: aooohan@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 66207] StringManager#getManager(String, Enumeration) cannot return the correct value
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66207
--- Comment #3 from HanLi <ao...@gmail.com> ---
It's not a bug, so close it.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 66207] StringManager#getManager(String, Enumeration) cannot return the correct value
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66207
--- Comment #1 from HanLi <ao...@gmail.com> ---
Similar to https://bz.apache.org/bugzilla/show_bug.cgi?id=63143
Repeat Konstantin Kolinko's reproduction steps:
1. Run JVM with an OS of a language that Tomcat has a translation available.
My OS uses Chinese language.
2. Configure a browser, to send "en-US" as the preferred language.
3. Start Tomcat, start the browser and access the Manager web application.
Expected: I expect the UI to be in English language.
Actual: The UI is in Chinese language.
But the reason for this problem is that Local's comparison, which differs from
Konstantin Kolinko's BZ.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 66207] StringManager#getManager(String, Enumeration) cannot return the correct value
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66207
HanLi <ao...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|NEW |RESOLVED
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 66207] StringManager#getManager(String, Enumeration) cannot return the correct value
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66207
--- Comment #2 from HanLi <ao...@gmail.com> ---
(In reply to HanLi from comment #1)
> The problem lies in the comparison, which I think should be a comparison of languages, not local objects, because Local(en) ! = Local(en-US)
> But the reason for this problem is that Local's comparison
These are wrong, ignore ignore
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org