tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remy Maucherat <>
Subject Re: IP issues
Date Wed, 05 Jan 2005 10:06:00 GMT
Davanum Srinivas wrote:
> +1 to rewrite the code and go past this problem.

Since the consensus was on rewriting/removing, I have done the following:

- removed the locale to encoding list (which will have to be 
reconstructed based on contributions); this opens up a relatively small 
compatibility issue with some web applications (in particluar, Servlet 
2.3 webapps assuming setLocale would magically set the encoding, and 
Servlet 2.4 webapps without proper locale to encoding declarations)

- replaced the original "algorithm" with this one:
     public String getCharset(Locale locale) {
         // Match full language_country_variant first, then 
         // then language only
         String charset = map.getProperty(locale.toString());
         if (charset == null) {
             charset = map.getProperty(locale.getLanguage() + "_"
                     + locale.getCountry());
             if (charset == null) {
                 charset = map.getProperty(locale.getLanguage());
         return (charset);

- removed the other file (LocaleToCharsetMap), which isn't used in 
Tomcat 5.x

The old tainted Tomcat 3 version is attached (LocaleToCharsetMap).
The version now used in TC 5.5 is attached as well (CharsetMapper). The 
class had been heavily rewritten by Craig already in the Tomcat 4.0 
branch, and the locale->encoding list was externalized to a file (good 
move by Craig, as usual).

This should hopefully clear the problem.


> On Wed, 5 Jan 2005 01:40:13 +0100, Oliver Zeigermann
> <> wrote:
>>On Tue, 4 Jan 2005 18:59:16 -0500 (EST), Henri Yandell
>><> >
>>>If the code is legally intricate, ie) ours but not under his CLA, then it
>>>seems quite easy for anyone to rewrite the method based on the method
>>>signature and the JDK file.
>>Looking at the code it really would be hard to rewrite it - not
>>because it is too complicated, but because it is pretty hard to think
>>of another way of doing it as it is so obvious.

View raw message