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
commit 82a1257a1addfe570813d687d153b309340b0549 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 30fa819..b01ca01 100644 --- a/java/org/apache/coyote/http2/Stream.java +++ b/java/org/apache/coyote/http2/Stream.java @@ -300,14 +300,19 @@ 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