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 2010/06/11 09:26:15 UTC

DO NOT REPLY [Bug 49426] New: Manager app wrongly localized

https://issues.apache.org/bugzilla/show_bug.cgi?id=49426

           Summary: Manager app wrongly localized
           Product: Tomcat 7
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Manager
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: mguillemot@yahoo.fr


Created an attachment (id=25582)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25582)
Patch (with unit test) fixing the problem for the ManagerServlet

The manager app shows message using the server's default locale whereas it
should react on the request Locale.

The cause is that the ManagerServlet uses StringManager what is fine for
messages that are logged but not for those that are sent as responses.

The attached patch fixes the problem for the ManagerServlet but not for the
HTMLManagerServlet. It will require a bit more refactoring there because the
same messages may be intended for log or for output to the response. I can
propose a second patch for it once the problem has been fixed for the
ManagerServlet.

For info: same problem occurs in Tomcat 6.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 49426] Manager app wrongly localized

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49426

--- Comment #4 from Mark Thomas <ma...@apache.org> 2010-06-14 17:48:05 EDT ---
(In reply to comment #3)
> OK, you're right. What about holding the ResourceBundle in a ThreadLocal?

Given all the issues we have seen with memory leaks and ThreadLocals I'd rather
not.

Some additional thoughts:
- we could just pass the Locale around with the writer
- I wonder how hard it would be to extend StringManager (efficiently - which
may be the slightly tricky bit) to support multiple Locales
- in determining which Locale to use we need to call request.getLocales() and
check each in turn until we find a suitable match.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 49426] Manager app wrongly localized

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49426

--- Comment #5 from Marc Guillemot <mg...@yahoo.fr> 2010-06-15 03:11:56 EDT ---
(In reply to comment #4)
> (In reply to comment #3)
> > OK, you're right. What about holding the ResourceBundle in a ThreadLocal?
> 
> Given all the issues we have seen with memory leaks and ThreadLocals I'd
> rather not.
> 
> Some additional thoughts:
> - we could just pass the Locale around with the writer

this would be the only solution when ThreadLocal is not wanted. I didn't want
to choose this way as it means more changes but I can do it.
Rather than passing writer and Locale (or ResourceBundle) everywhere along the
way, I could imagine having a wrapper for both.

> - I wonder how hard it would be to extend StringManager (efficiently - which
> may be the slightly tricky bit) to support multiple Locales

this wouldn't solve previous point: you have to be able to access the Locale
each time you need to get a String.
Additionally StringManager is quite useless. StringManager's cache doesn't make
sense as java.util.ResourceBundle has already one. This means that the only
value of StringManager is the facility method getString(final String key, final
Object... args).

> - in determining which Locale to use we need to call request.getLocales() and
> check each in turn until we find a suitable match.

this is correct. I didn't do it to keep the patch smaller in a first time but I
can adapt patch (including unit test) for that now if you want.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 49426] Manager app wrongly localized

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49426

--- Comment #2 from Mark Thomas <ma...@apache.org> 2010-06-13 16:52:36 EDT ---
-1 to the patch as currently written. It isn't thread safe.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 49426] Manager app wrongly localized

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49426

Marc Guillemot <mg...@yahoo.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #25582|0                           |1
        is obsolete|                            |

--- Comment #1 from Marc Guillemot <mg...@yahoo.fr> 2010-06-11 03:31:50 EDT ---
Created an attachment (id=25583)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25583)
Right patch (with unit test) fixing the problem for the ManagerServlet   (

Oops previous patch contained changes for HTMLManagerServlet that are not ready
yet. Attached the right version of the patch.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 49426] Manager app wrongly localized

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49426

--- Comment #3 from Marc Guillemot <mg...@yahoo.fr> 2010-06-14 03:13:31 EDT ---
OK, you're right. What about holding the ResourceBundle in a ThreadLocal?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 49426] Manager app wrongly localized

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49426

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #6 from Mark Thomas <ma...@apache.org> 2010-10-16 15:32:32 EDT ---
Fixed in trunk and will be in 7.0.5 onwards.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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