From b904a5cc85ef98950ea65a222fa2c36002895dc6 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Thu, 4 Jun 2020 11:49:42 +0200 Subject: [PATCH] Do not assume the ByteBuffer has a backing byte array. Signed-off-by: Simone Bordet --- .../java/org/eclipse/jetty/http2/hpack/HpackEncoder.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackEncoder.java b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackEncoder.java index 444b100afde..908cad7d791 100644 --- a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackEncoder.java +++ b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackEncoder.java @@ -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)); } }