You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2008/04/05 19:51:42 UTC

svn commit: r645147 - in /tomcat/tc6.0.x/trunk: STATUS.txt java/org/apache/tomcat/util/buf/B2CConverter.java

Author: markt
Date: Sat Apr  5 10:51:41 2008
New Revision: 645147

URL: http://svn.apache.org/viewvc?rev=645147&view=rev
Log:
Fix multi-byte character part of bug 44494

Modified:
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=645147&r1=645146&r2=645147&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Sat Apr  5 10:51:41 2008
@@ -113,19 +113,6 @@
   +1: markt, remm, fhanik
   -1:
 
-* Fix reading of multi-byte request data
-  https://issues.apache.org/bugzilla/show_bug.cgi?id=44494
-  http://svn.apache.org/viewvc?rev=642814&view=rev (clean-up)
-  http://svn.apache.org/viewvc?rev=642816&view=rev (more clean-up)
-  http://svn.apache.org/viewvc?rev=642819&view=rev (the fix)
-  This is Remy's patch from comment #23 less the one bad line (comment #28)
-  +1: markt, remm
-  +1: fhanik - for the actual fix
-  -1: fhanik - for the code cleanup, makes it hard to look back, 
-      and since this code is now in its third fix stage for something I believed could have been fixed simple, I would prefer it to  
-      be kept so that one can easily see change to change, without having to circumvent code cleanup and formatting
-      +1 for the code cleanup in trunk
-
 * Document missing secret attributes
   https://issues.apache.org/bugzilla/show_bug.cgi?id=44715
   http://svn.apache.org/viewvc?rev=643497&view=rev

Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java?rev=645147&r1=645146&r2=645147&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java Sat Apr  5 10:51:41 2008
@@ -77,35 +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 count = 0;
+	    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)
@@ -114,6 +107,7 @@
 	    throw ex;
 	}
     }
+
 
     public void reset()
 	throws IOException



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