tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1140463 - in /tomcat/trunk/java/org/apache/catalina: connector/Request.java ssi/SSIServletExternalResolver.java util/Base64.java
Date Tue, 28 Jun 2011 07:22:29 GMT
Author: markt
Date: Tue Jun 28 07:22:28 2011
New Revision: 1140463

URL: http://svn.apache.org/viewvc?rev=1140463&view=rev
Log:
Fix the remaining instances of new String(byte[] b, String enc) that can be fixed

Modified:
    tomcat/trunk/java/org/apache/catalina/connector/Request.java
    tomcat/trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java
    tomcat/trunk/java/org/apache/catalina/util/Base64.java

Modified: tomcat/trunk/java/org/apache/catalina/connector/Request.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Request.java?rev=1140463&r1=1140462&r2=1140463&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/Request.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Request.java Tue Jun 28 07:22:28 2011
@@ -1592,12 +1592,12 @@ public class Request
         // Ensure that the specified encoding is valid
         byte buffer[] = new byte[1];
         buffer[0] = (byte) 'a';
-        @SuppressWarnings("unused")
-        String s = new String(buffer, enc);
 
+        // Confirm that the encoding name is valid
+        B2CConverter.getCharset(enc);
+        
         // Save the validated encoding
         coyoteRequest.setCharacterEncoding(enc);
-
     }
 
 

Modified: tomcat/trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java?rev=1140463&r1=1140462&r2=1140463&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java Tue Jun 28 07:22:28
2011
@@ -36,6 +36,7 @@ import javax.servlet.http.HttpServletRes
 import org.apache.catalina.connector.Request;
 import org.apache.catalina.util.RequestUtil;
 import org.apache.coyote.Constants;
+import org.apache.tomcat.util.buf.B2CConverter;
 
 /**
  * An implementation of SSIExternalResolver that is used with servlets.
@@ -542,7 +543,8 @@ public class SSIServletExternalResolver 
             if (inputEncoding == null) {
                 retVal = new String( bytes );
             } else {
-                retVal = new String (bytes, inputEncoding);
+                retVal = new String (bytes,
+                        B2CConverter.getCharset(inputEncoding));
             }
 
             //make an assumption that an empty response is a failure. This is

Modified: tomcat/trunk/java/org/apache/catalina/util/Base64.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/util/Base64.java?rev=1140463&r1=1140462&r2=1140463&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/util/Base64.java (original)
+++ tomcat/trunk/java/org/apache/catalina/util/Base64.java Tue Jun 28 07:22:28 2011
@@ -19,6 +19,7 @@ package org.apache.catalina.util;
 
 import java.io.UnsupportedEncodingException;
 
+import org.apache.tomcat.util.buf.B2CConverter;
 import org.apache.tomcat.util.buf.ByteChunk;
 import org.apache.tomcat.util.buf.CharChunk;
 
@@ -173,7 +174,8 @@ public final class  Base64
 
         String result;
         try {
-            result = new String(encodedData, "ISO-8859-1");
+            result = new String(encodedData,
+                    B2CConverter.getCharset("ISO-8859-1"));
         } catch (UnsupportedEncodingException e) {
             // Should never happen but in case it does...
             result = new String(encodedData);



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


Mime
View raw message