Browse Source

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.
pull/1167/merge
Arjen Poutsma 9 years ago
parent
commit
d8f4d37624
  1. 2
      spring-core/src/main/java/org/springframework/core/io/buffer/DataBufferUtils.java

2
spring-core/src/main/java/org/springframework/core/io/buffer/DataBufferUtils.java

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

Loading…
Cancel
Save