hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r160486 - jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/NIOHttpDataReceiver.java
Date Thu, 07 Apr 2005 22:52:25 GMT
Author: olegk
Date: Thu Apr  7 15:52:24 2005
New Revision: 160486

URL: http://svn.apache.org/viewcvs?view=rev&rev=160486
Log:
Fixed a REALLY nasty bug related to the internal buffer and isDataAvailable method

Modified:
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/NIOHttpDataReceiver.java

Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/NIOHttpDataReceiver.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/NIOHttpDataReceiver.java?view=diff&r1=160485&r2=160486
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/NIOHttpDataReceiver.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/NIOHttpDataReceiver.java
Thu Apr  7 15:52:24 2005
@@ -89,6 +89,7 @@
     }
     
     protected int fillBuffer() throws IOException {
+        this.buffer.compact();
         int i = this.channel.read(this.buffer);
         this.buffer.flip();
         return i;
@@ -104,7 +105,6 @@
         }
         int noRead = 0;
         if (!this.buffer.hasRemaining()) {
-            this.buffer.clear();
             noRead = fillBuffer();
             if (noRead == -1) {
                 return -1; 
@@ -128,7 +128,6 @@
     public int read() throws IOException {
         int noRead = 0;
         if (!this.buffer.hasRemaining()) {
-            this.buffer.clear();
             noRead = fillBuffer();
             if (noRead == -1) {
                 return -1; 
@@ -181,7 +180,6 @@
                     chardecoder.decode(this.buffer, tmp, false);
                 }
                 // discard the decoded content
-                this.buffer.compact();
                 noRead = fillBuffer();
                 if (noRead == -1) {
                     retry = false;



Mime
View raw message