hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r963847 - in /httpcomponents/httpcore/branches/4.0.x: ./ httpcore-nio/ httpcore/ httpcore/src/main/java/org/apache/http/impl/io/ httpcore/src/test/java/org/apache/http/impl/
Date Tue, 13 Jul 2010 20:01:22 GMT
Author: olegk
Date: Tue Jul 13 20:01:21 2010
New Revision: 963847

URL: http://svn.apache.org/viewvc?rev=963847&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/branches/4.0.x/   (props changed)
    httpcomponents/httpcore/branches/4.0.x/RELEASE_NOTES.txt
    httpcomponents/httpcore/branches/4.0.x/httpcore/   (props changed)
    httpcomponents/httpcore/branches/4.0.x/httpcore-nio/   (props changed)
    httpcomponents/httpcore/branches/4.0.x/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java
    httpcomponents/httpcore/branches/4.0.x/httpcore/src/test/java/org/apache/http/impl/TestSessionBuffers.java

Propchange: httpcomponents/httpcore/branches/4.0.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jul 13 20:01:21 2010
@@ -1 +1 @@
-/httpcomponents/httpcore/trunk:959930-959931
+/httpcomponents/httpcore/trunk:959930-959931,963844

Modified: httpcomponents/httpcore/branches/4.0.x/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.0.x/RELEASE_NOTES.txt?rev=963847&r1=963846&r2=963847&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.0.x/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpcore/branches/4.0.x/RELEASE_NOTES.txt Tue Jul 13 20:01:21 2010
@@ -1,5 +1,9 @@
 Changes since 4.0.1
 
+* [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>
+
 * [HTTPCORE-228] Fixed NPE in AsyncNHttpServiceHandler caused by entity enclosing requests
   if no matching request handler can be found.  
   Contributed by Oleg Kalnichevski <olegk at apache.org>

Propchange: httpcomponents/httpcore/branches/4.0.x/httpcore/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jul 13 20:01:21 2010
@@ -0,0 +1 @@
+/httpcomponents/httpcore/trunk/httpcore:963844

Propchange: httpcomponents/httpcore/branches/4.0.x/httpcore-nio/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jul 13 20:01:21 2010
@@ -0,0 +1 @@
+/httpcomponents/httpcore/trunk/httpcore-nio:963844

Modified: httpcomponents/httpcore/branches/4.0.x/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.0.x/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java?rev=963847&r1=963846&r2=963847&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.0.x/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java
(original)
+++ httpcomponents/httpcore/branches/4.0.x/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java
Tue Jul 13 20:01:21 2010
@@ -283,6 +283,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);
         }
         return l;
@@ -305,6 +306,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/branches/4.0.x/httpcore/src/test/java/org/apache/http/impl/TestSessionBuffers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.0.x/httpcore/src/test/java/org/apache/http/impl/TestSessionBuffers.java?rev=963847&r1=963846&r2=963847&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.0.x/httpcore/src/test/java/org/apache/http/impl/TestSessionBuffers.java
(original)
+++ httpcomponents/httpcore/branches/4.0.x/httpcore/src/test/java/org/apache/http/impl/TestSessionBuffers.java
Tue Jul 13 20:01:21 2010
@@ -468,7 +468,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