From 1d2e9da29cfb7fe9f5bc7abb0e914d939f8c8a5f Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 10 Jun 2014 12:00:20 +0200 Subject: [PATCH] Clearing the buffer before returning it. --- .../src/main/java/org/eclipse/jetty/io/ByteBufferPool.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferPool.java b/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferPool.java index 61c78fcb853..b9e9e0978b0 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferPool.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferPool.java @@ -22,6 +22,8 @@ import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; +import org.eclipse.jetty.util.BufferUtil; + /** *

A {@link ByteBuffer} pool.

*

Acquired buffers may be {@link #release(ByteBuffer) released} but they do not need to; @@ -67,6 +69,7 @@ public interface ByteBufferPool public ByteBuffer acquire(int capacity, boolean direct) { ByteBuffer buffer = byteBufferPool.acquire(capacity, direct); + BufferUtil.clearToFill(buffer); append(buffer, true); return buffer; }