You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2012/09/13 22:22:12 UTC
svn commit: r1384511 -
/cxf/trunk/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/SharedInputBuffer.java
Author: dkulp
Date: Thu Sep 13 20:22:12 2012
New Revision: 1384511
URL: http://svn.apache.org/viewvc?rev=1384511&view=rev
Log:
Fix another issue with an read buffer with offset != 0
Modified:
cxf/trunk/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/SharedInputBuffer.java
Modified: cxf/trunk/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/SharedInputBuffer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/SharedInputBuffer.java?rev=1384511&r1=1384510&r2=1384511&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/SharedInputBuffer.java (original)
+++ cxf/trunk/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/SharedInputBuffer.java Thu Sep 13 20:22:12 2012
@@ -169,12 +169,20 @@ public class SharedInputBuffer extends E
}
}
- protected void waitForData() throws IOException {
+ protected void waitForData(int waitPos) throws IOException {
this.lock.lock();
try {
try {
- while ((this.waitingBuffer != null && this.waitingBuffer.position() == 0)
- && !super.hasData() && !this.endOfStream) {
+ while (true) {
+ if (this.waitingBuffer != null && this.waitingBuffer.position() > waitPos) {
+ return;
+ }
+ if (super.hasData()) {
+ return;
+ }
+ if (this.endOfStream) {
+ return;
+ }
if (this.shutdown) {
throw new InterruptedIOException("Input operation aborted");
}
@@ -231,12 +239,13 @@ public class SharedInputBuffer extends E
}
this.lock.lock();
try {
- if (!hasData()) {
- waitForData();
+ if (!super.hasData()) {
+ waitForData(0);
}
if (isEndOfStream()) {
return -1;
}
+ setOutputMode();
return this.buffer.get() & 0xff;
} finally {
this.lock.unlock();
@@ -254,7 +263,7 @@ public class SharedInputBuffer extends E
try {
if (!hasData()) {
this.waitingBuffer = ByteBuffer.wrap(b, off, len);
- waitForData();
+ waitForData(off);
int i = waitingBuffer.position() - off;
waitingBuffer = null;
if (i > 0) {