You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by fh...@apache.org on 2007/08/22 18:57:14 UTC

svn commit: r568699 - /tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/B2CConverter.java

Author: fhanik
Date: Wed Aug 22 09:57:13 2007
New Revision: 568699

URL: http://svn.apache.org/viewvc?rev=568699&view=rev
Log:
Fix broken UTF-8 handling, the B2CConverter doesn't respect that the entire message doesn't fit in the buffer.
this fix takes care of that by checking the buffer, if no data is available, then it will not try to do more conversions.


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

Modified: tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/B2CConverter.java
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/B2CConverter.java?rev=568699&r1=568698&r2=568699&view=diff
==============================================================================
--- tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/B2CConverter.java (original)
+++ tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/B2CConverter.java Wed Aug 22 09:57:13 2007
@@ -82,7 +82,7 @@
     {
         try {
             // read from the reader
-            while( true ) { // conv.ready() ) {
+            while( iis.available()>0 ) { // conv.ready() ) {
                 int cnt=conv.read( result, 0, BUFFER_SIZE );
                 if( cnt <= 0 ) {
                     // End of stream ! - we may be in a bad state
@@ -251,6 +251,11 @@
     public  final int read() throws IOException {
         return (pos < end ) ? (buf[pos++] & 0xff) : -1;
     }
+    
+    public int available() throws IOException {
+        return end-pos;
+    }
+
 
     // -------------------- Internal methods --------------------
 



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