hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r963844 - in /httpcomponents/httpcore/trunk: RELEASE_NOTES.txt httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java httpcore/src/test/java/org/apache/http/impl/TestSessionBuffers.java
Date Tue, 13 Jul 2010 19:52:00 GMT
Author: olegk
Date: Tue Jul 13 19:52:00 2010
New Revision: 963844

URL: http://svn.apache.org/viewvc?rev=963844&view=rev
Log:
HTTPCORE-229: AbstractSessionInputBuffer#readLine(CharArrayBuffer) returns incorrect number
of characters read by the method when using non-standard HTTP element charset

Modified:
    httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestSessionBuffers.java

Modified: httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt?rev=963844&r1=963843&r2=963844&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpcore/trunk/RELEASE_NOTES.txt Tue Jul 13 19:52:00 2010
@@ -1,5 +1,9 @@
 Changes since 4.1-BETA1 
 
+* [HTTPCORE-229] AbstractSessionInputBuffer#readLine(CharArrayBuffer) returns incorrect 
+  number of characters read by the method when using non-standard HTTP element charset.
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
 * Non-blocking connections can trigger #responseReady / #requestReady events by mistake
   when the underlying session is already closed.
   Contributed by Oleg Kalnichevski <olegk at apache.org>

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java?rev=963844&r1=963843&r2=963844&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java
Tue Jul 13 19:52:00 2010
@@ -303,6 +303,7 @@ public abstract class AbstractSessionInp
             // This is VERY memory inefficient, BUT since non-ASCII charsets are
             // NOT meant to be used anyway, there's no point optimizing it
             String s = new String(this.linebuffer.buffer(), 0, l, this.charset);
+            l = s.length();
             charbuffer.append(s);
         }
         this.linebuffer.clear();
@@ -326,6 +327,7 @@ public abstract class AbstractSessionInp
             // NOT meant to be used anyway, there's no point optimizing it
             String s = new String(this.buffer, off, len, this.charset);
             charbuffer.append(s);
+            len = s.length();
         }
         return len;
     }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestSessionBuffers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestSessionBuffers.java?rev=963844&r1=963843&r2=963844&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestSessionBuffers.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestSessionBuffers.java
Tue Jul 13 19:52:00 2010
@@ -469,7 +469,10 @@ public class TestSessionBuffers extends 
         HttpProtocolParams.setHttpElementCharset(params, HTTP.ISO_8859_1);
 
         for (int i = 0; i < 10; i++) {
-            assertEquals(s1, inbuffer.readLine());
+            CharArrayBuffer buf = new CharArrayBuffer(64);
+            int len = inbuffer.readLine(buf);
+            assertEquals(len, SWISS_GERMAN_HELLO.length);
+            assertEquals(s1, buf.toString());
         }
         assertNull(inbuffer.readLine());
         assertNull(inbuffer.readLine());



Mime
View raw message