Commit 462f42cc authored by mhellka's avatar mhellka
Browse files

Fixed sync request entity read not updating array backed ByteBuffers correctly.

parent 9e9677fb
......@@ -142,8 +142,12 @@ public interface RestContext extends AutoCloseable {
* @throws IOException if an IO error occurred.
*/
default int read(ByteBuffer buffer) throws IOException {
if (buffer.hasArray())
return read(buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.remaining());
if (buffer.hasArray()) {
final int nb = read(buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.remaining());
if (nb > 0)
buffer.position(buffer.position() + nb);
return nb;
}
final byte[] buff = new byte[buffer.remaining()];
final int i = read(buff);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment