hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r280106 - /jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/io/InputStreamHttpDataReceiver.java
Date Sun, 11 Sep 2005 11:39:49 GMT
Author: olegk
Date: Sun Sep 11 04:39:45 2005
New Revision: 280106

URL: http://svn.apache.org/viewcvs?rev=280106&view=rev
Log:
Fixed a rather nasty bug in the input buffering code

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

Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/io/InputStreamHttpDataReceiver.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/io/InputStreamHttpDataReceiver.java?rev=280106&r1=280105&r2=280106&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/io/InputStreamHttpDataReceiver.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/io/InputStreamHttpDataReceiver.java
Sun Sep 11 04:39:45 2005
@@ -86,17 +86,14 @@
     	}
     	int l;
     	int off = this.bufferlen;
-    	int len = this.buffer.length - this.bufferlen;
-    	while ((l = this.instream.read(this.buffer, off, len)) > 0) {
-    		off += l;
-            len -= l;
+    	int len = this.buffer.length - off;
+    	l = this.instream.read(this.buffer, off, len);
+    	if (l == -1) {
+    		return -1;
+    	} else {
+        	this.bufferlen = off + l;
+        	return l;
     	}
-    	this.bufferlen = off;
-        if (l == -1 && off == 0) {
-            return -1;
-        } else {
-            return off;
-        }
     }
 
     protected boolean hasBufferedData() {



Mime
View raw message