This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push: new 33fefc9 Fix NPE 33fefc9 is described below commit 33fefc9e935f1967cf6dffcd85abb60dbd5837b6 Author: Mark Thomas <ma...@apache.org> AuthorDate: Tue Mar 23 12:51:07 2021 +0000 Fix NPE --- java/org/apache/coyote/http2/Stream.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/java/org/apache/coyote/http2/Stream.java b/java/org/apache/coyote/http2/Stream.java index 5b96d99..dc6ef2d 100644 --- a/java/org/apache/coyote/http2/Stream.java +++ b/java/org/apache/coyote/http2/Stream.java @@ -680,8 +680,15 @@ class Stream extends AbstractNonZeroStream implements HeaderEmitter { if (log.isDebugEnabled()) { log.debug(sm.getString("stream.recycle", getConnectionId(), getIdAsString())); } - handler.replaceStream( - this, new RecycledStream(getConnectionId(), getIdentifier(), state, getInputByteBuffer().remaining())); + int remaining; + // May be null if stream was closed before any DATA frames were processed. + ByteBuffer inputByteBuffer = getInputByteBuffer(); + if (inputByteBuffer == null) { + remaining = 0; + } else { + remaining = inputByteBuffer.remaining(); + } + handler.replaceStream(this, new RecycledStream(getConnectionId(), getIdentifier(), state, remaining)); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org