Author: kkolinko Date: Fri Feb 8 23:54:41 2013 New Revision: 1444289 URL: http://svn.apache.org/r1444289 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54248 Need to reset the decoder when the B2C converter is recycled to ensure BOMs are correctly handled for those encodings that require them. Backport of r1430083 from 7.0.x
Modified: tomcat/tc6.0.x/branches/tomcat6-testing/ (props changed) tomcat/tc6.0.x/branches/tomcat6-testing/STATUS.txt tomcat/tc6.0.x/branches/tomcat6-testing/java/org/apache/tomcat/util/buf/B2CConverter.java tomcat/tc6.0.x/branches/tomcat6-testing/webapps/docs/changelog.xml Propchange: tomcat/tc6.0.x/branches/tomcat6-testing/ ------------------------------------------------------------------------------ Merged /tomcat/trunk:r1430079 Merged /tomcat/tc7.0.x/trunk:r1430083 Modified: tomcat/tc6.0.x/branches/tomcat6-testing/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/branches/tomcat6-testing/STATUS.txt?rev=1444289&r1=1444288&r2=1444289&view=diff ============================================================================== --- tomcat/tc6.0.x/branches/tomcat6-testing/STATUS.txt (original) +++ tomcat/tc6.0.x/branches/tomcat6-testing/STATUS.txt Fri Feb 8 23:54:41 2013 @@ -90,13 +90,6 @@ PATCHES PROPOSED TO BACKPORT: +1: kkolinko, schultz -1: -* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54248 - Need to reset the decoder when the B2C converter is recycled to ensure BOMs - are correctly handled for those encodings that require them. - http://svn.apache.org/viewvc?rev=1430083&view=rev - +1: markt, kkolinko, schultz - -1: - * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54382 Avoid NPE with an empty SSI directive http://svn.apache.org/viewvc?view=revision&revision=1430553 Modified: tomcat/tc6.0.x/branches/tomcat6-testing/java/org/apache/tomcat/util/buf/B2CConverter.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/branches/tomcat6-testing/java/org/apache/tomcat/util/buf/B2CConverter.java?rev=1444289&r1=1444288&r2=1444289&view=diff ============================================================================== --- tomcat/tc6.0.x/branches/tomcat6-testing/java/org/apache/tomcat/util/buf/B2CConverter.java (original) +++ tomcat/tc6.0.x/branches/tomcat6-testing/java/org/apache/tomcat/util/buf/B2CConverter.java Fri Feb 8 23:54:41 2013 @@ -23,6 +23,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; +import java.nio.charset.CharsetDecoder; import java.util.HashMap; import java.util.Locale; import java.util.Map; @@ -75,6 +76,7 @@ public class B2CConverter { private IntermediateInputStream iis; private ReadConvertor conv; + private CharsetDecoder decoder; private String encoding; protected B2CConverter() { @@ -95,6 +97,7 @@ public class B2CConverter { */ public void recycle() { conv.recycle(); + decoder.reset(); } static final int BUFFER_SIZE=8192; @@ -149,12 +152,11 @@ public class B2CConverter { } - public void reset() - throws IOException - { - // destroy the reader/iis - iis=new IntermediateInputStream(); - conv=new ReadConvertor( iis, getCharset(encoding) ); + public void reset() throws IOException { + // Re-create the reader and iis + iis = new IntermediateInputStream(); + decoder = getCharset(encoding).newDecoder(); + conv = new ReadConvertor(iis, decoder); } private final int debug=0; @@ -232,9 +234,8 @@ final class ReadConvertor extends Input /** Create a converter. */ - public ReadConvertor( IntermediateInputStream in, Charset charset ) - { - super( in, charset ); + public ReadConvertor(IntermediateInputStream in, CharsetDecoder decoder) { + super(in, decoder); } /** Overriden - will do nothing but reset internal state. Modified: tomcat/tc6.0.x/branches/tomcat6-testing/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/branches/tomcat6-testing/webapps/docs/changelog.xml?rev=1444289&r1=1444288&r2=1444289&view=diff ============================================================================== --- tomcat/tc6.0.x/branches/tomcat6-testing/webapps/docs/changelog.xml (original) +++ tomcat/tc6.0.x/branches/tomcat6-testing/webapps/docs/changelog.xml Fri Feb 8 23:54:41 2013 @@ -75,6 +75,15 @@ </fix> </changelog> </subsection> + <subsection name="Coyote"> + <changelog> + <fix> + <bug>54248</bug>: Ensure that byte order marks are swallowed when using + a Reader to read a request body with a BOM for those encodings that + require byte order marks. (markt) + </fix> + </changelog> + </subsection> <subsection name="Web applications"> <changelog> <fix> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org