Skip to content

Commit

Permalink
Fix #11756 empty byte array for no content in ChunkAccumulator
Browse files Browse the repository at this point in the history
Fix #11756 empty byte array for no content in ChunkAccumulator
  • Loading branch information
gregw committed May 21, 2024
1 parent 1b82757 commit 734351f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 734351f

Please sign in to comment.