Do not assume the ByteBuffer has a backing byte array.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2020-06-04 11:49:42 +02:00
parent 38f56f5973
commit b904a5cc85
1 changed files with 4 additions and 3 deletions

View File

@ -423,9 +423,10 @@ public class HpackEncoder
if (_debug)
{
int e = buffer.position();
if (LOG.isDebugEnabled())
LOG.debug("encode {}:'{}' to '{}'", encoding, field, TypeUtil.toHexString(buffer.array(), buffer.arrayOffset() + p, e - p));
byte[] bytes = new byte[buffer.position() - p];
buffer.position(p);
buffer.get(bytes);
LOG.debug("encode {}:'{}' to '{}'", encoding, field, TypeUtil.toHexString(bytes));
}
}