Fixed bug in reading Flux from Channel

Fixed bug where the returned Flux from DataBufferUtils.read() would be
completed prematurely if the channel was not ready to read, but did
not reach the end of the file either.
This commit is contained in:
Arjen Poutsma
2016-09-12 19:23:15 +02:00
parent 61bf6a25b7
commit d8f4d37624

View File

@@ -164,7 +164,7 @@ public abstract class DataBufferUtils {
try {
ByteBuffer byteBuffer = ByteBuffer.allocate(chunkSize);
int read;
if ((read = channel.read(byteBuffer)) > 0) {
if ((read = channel.read(byteBuffer)) >= 0) {
byteBuffer.flip();
boolean release = true;
DataBuffer dataBuffer = this.dataBufferFactory.allocateBuffer(read);