diff --git a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ChunkAccumulator.java b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ChunkAccumulator.java index 0358f8583969..c0c37eb34111 100644 --- a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ChunkAccumulator.java +++ b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ChunkAccumulator.java @@ -72,7 +72,7 @@ public int length() public byte[] take() { if (_length == 0) - return BufferUtil.EMPTY_BUFFER.array(); + return BufferUtil.EMPTY_BYTES; byte[] bytes = new byte[_length]; int offset = 0; for (Chunk chunk : _chunks) diff --git a/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/BufferUtil.java b/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/BufferUtil.java index 3d771910596d..82d39988bcd4 100644 --- a/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/BufferUtil.java +++ b/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/BufferUtil.java @@ -106,7 +106,8 @@ public class BufferUtil (byte)'E', (byte)'F' }; - public static final ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(new byte[0]).asReadOnlyBuffer(); + public static final byte[] EMPTY_BYTES = new byte[0]; + public static final ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES).asReadOnlyBuffer(); /** * Allocate ByteBuffer in flush mode.