This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 7f6f2ed88f31d18f6c3308026d006fcb23f4227b Author: Mark Thomas <ma...@apache.org> AuthorDate: Thu Aug 27 13:52:44 2020 +0100 Avoid NPE observed in CI --- java/org/apache/coyote/http2/Stream.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/java/org/apache/coyote/http2/Stream.java b/java/org/apache/coyote/http2/Stream.java index 1b750ef..148eae8 100644 --- a/java/org/apache/coyote/http2/Stream.java +++ b/java/org/apache/coyote/http2/Stream.java @@ -297,14 +297,19 @@ public class Stream extends AbstractStream implements HeaderEmitter { void doStreamCancel(String msg, Http2Error error) throws CloseNowException { + // Avoid NPEs on duplicate cancellations + StreamOutputBuffer streamOutputBuffer = this.streamOutputBuffer; + Response coyoteResponse = this.coyoteResponse; StreamException se = new StreamException(msg, error, getIdAsInt()); - // Prevent the application making further writes - streamOutputBuffer.closed = true; - // Prevent Tomcat's error handling trying to write - coyoteResponse.setError(); - coyoteResponse.setErrorReported(); - // Trigger a reset once control returns to Tomcat - streamOutputBuffer.reset = se; + if (streamOutputBuffer != null && coyoteResponse != null) { + // Prevent the application making further writes + streamOutputBuffer.closed = true; + // Prevent Tomcat's error handling trying to write + coyoteResponse.setError(); + coyoteResponse.setErrorReported(); + // Trigger a reset once control returns to Tomcat + streamOutputBuffer.reset = se; + } throw new CloseNowException(msg, se); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org