Author: markt Date: Wed Sep 11 21:10:37 2013 New Revision: 1522038 URL: http://svn.apache.org/r1522038 Log: If both the input and output buffers are exhausted at the same time, return UNDERFLOW as more input data would be required to trigger OVERFLOW.
Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/buf/Utf8Encoder.java Propchange: tomcat/tc7.0.x/trunk/ ------------------------------------------------------------------------------ Merged /tomcat/trunk:r1522016 Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/buf/Utf8Encoder.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/buf/Utf8Encoder.java?rev=1522038&r1=1522037&r2=1522038&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/buf/Utf8Encoder.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/buf/Utf8Encoder.java Wed Sep 11 21:10:37 2013 @@ -23,7 +23,8 @@ import java.nio.charset.CoderResult; import java.nio.charset.StandardCharsets; /** - * Encodes characters as bytes using UTF-8. Extracted from Apache Harmony. + * Encodes characters as bytes using UTF-8. Extracted from Apache Harmony with + * some minor bug fixes applied. */ public class Utf8Encoder extends CharsetEncoder { @@ -132,7 +133,12 @@ public class Utf8Encoder extends Charset if (outRemaining == 0) { in.position(x + 1); out.position(outPos); - return CoderResult.OVERFLOW; + // If both input and output are exhausted, return UNDERFLOW + if (x + 1 == limit) { + return CoderResult.UNDERFLOW; + } else { + return CoderResult.OVERFLOW; + } } } @@ -226,5 +232,4 @@ public class Utf8Encoder extends Charset } return CoderResult.UNDERFLOW; } - } \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org