[#1520] Release previous set buffer when setting a new data source
This commit is contained in:
parent
45d20d5c9f
commit
1fee1ef74e
@ -53,6 +53,9 @@ public abstract class AbstractMemoryHttpData extends AbstractHttpData {
|
|||||||
throw new IOException("Out of size: " + localsize + " > " +
|
throw new IOException("Out of size: " + localsize + " > " +
|
||||||
definedSize);
|
definedSize);
|
||||||
}
|
}
|
||||||
|
if (byteBuf != null) {
|
||||||
|
byteBuf.release();
|
||||||
|
}
|
||||||
byteBuf = buffer;
|
byteBuf = buffer;
|
||||||
size = localsize;
|
size = localsize;
|
||||||
completed = true;
|
completed = true;
|
||||||
@ -76,6 +79,9 @@ public abstract class AbstractMemoryHttpData extends AbstractHttpData {
|
|||||||
if (definedSize > 0 && definedSize < size) {
|
if (definedSize > 0 && definedSize < size) {
|
||||||
throw new IOException("Out of size: " + size + " > " + definedSize);
|
throw new IOException("Out of size: " + size + " > " + definedSize);
|
||||||
}
|
}
|
||||||
|
if (byteBuf != null) {
|
||||||
|
byteBuf.release();
|
||||||
|
}
|
||||||
byteBuf = buffer;
|
byteBuf = buffer;
|
||||||
completed = true;
|
completed = true;
|
||||||
}
|
}
|
||||||
@ -133,6 +139,9 @@ public abstract class AbstractMemoryHttpData extends AbstractHttpData {
|
|||||||
fileChannel.close();
|
fileChannel.close();
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
byteBuffer.flip();
|
byteBuffer.flip();
|
||||||
|
if (byteBuf != null) {
|
||||||
|
byteBuf.release();
|
||||||
|
}
|
||||||
byteBuf = wrappedBuffer(byteBuffer);
|
byteBuf = wrappedBuffer(byteBuffer);
|
||||||
size = newsize;
|
size = newsize;
|
||||||
completed = true;
|
completed = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user