Author: markt
Date: Sun Mar 30 14:13:36 2008
New Revision: 642819

URL: http://svn.apache.org/viewvc?rev=642819&view=rev
Log:
Apply Remy's patch for 44494 for multi-byte character data.

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=642819&r1=642818&r2=642819&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java Sun Mar 30 
14:13:36 2008
@@ -77,34 +77,28 @@
         convert(bb, cb, cb.getBuffer().length - cb.getEnd());
     }
 
+
     public void convert( ByteChunk bb, CharChunk cb, int limit) 
         throws IOException
     {
         iis.setByteChunk( bb );
-        convert(cb, limit);
-    }
-
-    private void convert(CharChunk cb, int limit)
-        throws IOException
-    {
         try {
             // read from the reader
+            int bbLengthBeforeRead = 0;
             while( limit > 0 ) { // conv.ready() ) {
                 int size = limit < BUFFER_SIZE ? limit : BUFFER_SIZE;
+                bbLengthBeforeRead = bb.getLength();
                 int cnt=conv.read( result, 0, size );
                 if( cnt <= 0 ) {
                     // End of stream ! - we may be in a bad state
                     if( debug>0)
                         log( "EOF" );
-                    //                    reset();
                     return;
                 }
                 if( debug > 1 )
                     log("Converted: " + new String( result, 0, cnt ));
-
-                // XXX go directly
                 cb.append( result, 0, cnt );
-                limit -= cnt;
+                limit = limit - (bbLengthBeforeRead - bb.getLength());
             }
         } catch( IOException ex) {
             if( debug>0)
@@ -113,6 +107,7 @@
             throw ex;
         }
     }
+
 
     public void reset()
         throws IOException



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to