hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1509556 - in /httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods: AsyncByteConsumer.java AsyncCharConsumer.java
Date Fri, 02 Aug 2013 06:39:49 GMT
Author: olegk
Date: Fri Aug  2 06:39:48 2013
New Revision: 1509556

URL: http://svn.apache.org/r1509556
Log:
HTTPASYNC-40: Cannot suspend input when using AsyncByteConsumer / AsyncCharConsumer

Modified:
    httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncByteConsumer.java
    httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncCharConsumer.java

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncByteConsumer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncByteConsumer.java?rev=1509556&r1=1509555&r2=1509556&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncByteConsumer.java
(original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncByteConsumer.java
Fri Aug  2 06:39:48 2013
@@ -63,11 +63,8 @@ public abstract class AsyncByteConsumer<
     protected final void onContentReceived(
             final ContentDecoder decoder, final IOControl ioctrl) throws IOException {
         Asserts.notNull(this.bbuf, "Byte buffer");
-        for (;;) {
-            final int bytesRead = decoder.read(this.bbuf);
-            if (bytesRead <= 0) {
-                break;
-            }
+        final int bytesRead = decoder.read(this.bbuf);
+        if (bytesRead > 0) {
             this.bbuf.flip();
             onByteReceived(this.bbuf, ioctrl);
             this.bbuf.clear();

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncCharConsumer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncCharConsumer.java?rev=1509556&r1=1509555&r2=1509556&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncCharConsumer.java
(original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncCharConsumer.java
Fri Aug  2 06:39:48 2013
@@ -78,11 +78,8 @@ public abstract class AsyncCharConsumer<
     protected final void onContentReceived(
             final ContentDecoder decoder, final IOControl ioctrl) throws IOException {
         Asserts.notNull(this.bbuf, "Byte buffer");
-        for (;;) {
-            final int bytesRead = decoder.read(this.bbuf);
-            if (bytesRead <= 0) {
-                break;
-            }
+        final int bytesRead = decoder.read(this.bbuf);
+        if (bytesRead > 0) {
             this.bbuf.flip();
             final boolean completed = decoder.isCompleted();
             CoderResult result = this.chardecoder.decode(this.bbuf, this.cbuf, completed);



Mime
View raw message