2011/6/27 <ma...@apache.org>: > Author: markt > Date: Mon Jun 27 15:19:22 2011 > New Revision: 1140204 > > URL: http://svn.apache.org/viewvc?rev=1140204&view=rev > Log: > Need to include aliases in charset cache > > Modified: > tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java >
15:19:22 2011 > @@ -55,8 +55,11 @@ public class B2CConverter { > static { > for (Entry<String,Charset> entry : > Charset.availableCharsets().entrySet()) { > - encodingToCharsetCache.put(entry.getKey().toLowerCase(), > - entry.getValue()); > + Charset charset = entry.getValue(); > + encodingToCharsetCache.put(entry.getKey().toLowerCase(), > charset); Getting the name can be a bit simplified: charset.name().toLowerCase(Locale.US) thus no need to access the key and loop can be simplified a bit. > + for (String alias : charset.aliases()) { > + encodingToCharsetCache.put(alias, charset); Should be: s/alias/alias.toLowerCase(Locale.US)/ > + } > } > } I was wondering how slow is Charset.availableCharsets(). In my test it is about 100ms. Nothing to worry about. Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org