tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1140153 - /tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java
Date Mon, 27 Jun 2011 13:23:29 GMT
Author: markt
Date: Mon Jun 27 13:23:28 2011
New Revision: 1140153

URL: http://svn.apache.org/viewvc?rev=1140153&view=rev
Log:
Prevent multiple variations of the same sncoding filling up the cache

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java?rev=1140153&r1=1140152&r2=1140153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java Mon Jun 27 13:23:28 2011
@@ -25,6 +25,7 @@ import java.io.UnsupportedEncodingExcept
 import java.nio.charset.Charset;
 import java.nio.charset.IllegalCharsetNameException;
 import java.nio.charset.UnsupportedCharsetException;
+import java.util.Locale;
 import java.util.concurrent.ConcurrentHashMap;
 
 /** Efficient conversion of bytes  to character .
@@ -50,7 +51,10 @@ public class B2CConverter {
     public static Charset getCharset(String enc)
             throws UnsupportedEncodingException{
 
-        Charset charset = encodingToCharsetCache.get(enc);
+        // Encoding names should all be ASCII
+        String lowerCaseEnc = enc.toLowerCase(Locale.US);
+
+        Charset charset = encodingToCharsetCache.get(lowerCaseEnc);
         if (charset == null) {
             try {
                 charset = Charset.forName(enc);



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message