https://issues.apache.org/bugzilla/show_bug.cgi?id=44494
--- Comment #23 from Remy Maucherat <[EMAIL PROTECTED]> 2008-03-25 18:27:12 PST --- Ok, first of all thanks a lot for the test case (I wouldn't be able to write a good multibyte test to save my life). As with the original bug, the problem is with the limit being incorrect (reading too much causes causes the ByteBuffer to refill itself magically, while the calling code still hasn't seen anything back). In the loop, the limit int represents bytes, but is decremented with the amount of chars read (which works with single byte charsets, obviously ...). The new loop would be (replacing the old convert method): public void convert(ByteChunk bb, CharChunk cb, int limit) throws IOException { iis.setByteChunk(bb); try { // read from the reader int l = 0; while( limit > 0 ) { // conv.ready() ) { int size = limit < BUFFER_SIZE ? limit : BUFFER_SIZE; l = 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 )); cb.setLimit(cb.getStart() + cnt); cb.append( result, 0, cnt ); limit = limit - (l - bb.getLength()); } } catch( IOException ex) { if( debug>0) log( "Reseting the converter " + ex.toString() ); reset(); throw ex; } } -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]