diff --git a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HTTP2ServerConnection.java b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HTTP2ServerConnection.java index 1711782fa11..f2a6a9fff28 100644 --- a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HTTP2ServerConnection.java +++ b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HTTP2ServerConnection.java @@ -140,15 +140,18 @@ public class HTTP2ServerConnection extends HTTP2Connection implements Connection if (LOG.isDebugEnabled()) LOG.debug("Processing {} on {}", frame, stream); HttpChannelOverHTTP2 channel = (HttpChannelOverHTTP2)stream.getAttribute(IStream.CHANNEL_ATTRIBUTE); - Runnable task = channel.onRequestContent(frame, callback); - if (task != null) - offerTask(task, false); + if (channel != null) + { + Runnable task = channel.onRequestContent(frame, callback); + if (task != null) + offerTask(task, false); + } } public boolean onStreamTimeout(IStream stream, Throwable failure) { HttpChannelOverHTTP2 channel = (HttpChannelOverHTTP2)stream.getAttribute(IStream.CHANNEL_ATTRIBUTE); - boolean result = channel.onStreamTimeout(failure); + boolean result = channel != null && channel.onStreamTimeout(failure); if (LOG.isDebugEnabled()) LOG.debug("{} idle timeout on {}: {}", result ? "Processed" : "Ignored", stream, failure); return result; @@ -159,7 +162,8 @@ public class HTTP2ServerConnection extends HTTP2Connection implements Connection if (LOG.isDebugEnabled()) LOG.debug("Processing failure on {}: {}", stream, failure); HttpChannelOverHTTP2 channel = (HttpChannelOverHTTP2)stream.getAttribute(IStream.CHANNEL_ATTRIBUTE); - channel.onFailure(failure); + if (channel != null) + channel.onFailure(failure); } public boolean onSessionTimeout(Throwable failure) @@ -169,7 +173,8 @@ public class HTTP2ServerConnection extends HTTP2Connection implements Connection for (Stream stream : session.getStreams()) { HttpChannelOverHTTP2 channel = (HttpChannelOverHTTP2)stream.getAttribute(IStream.CHANNEL_ATTRIBUTE); - result &= !channel.isRequestHandled(); + if (channel != null) + result &= !channel.isRequestHandled(); } if (LOG.isDebugEnabled()) LOG.debug("{} idle timeout on {}: {}", result ? "Processed" : "Ignored", session, failure); diff --git a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java index d8b53fa8f64..4e49adc2ee7 100644 --- a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java +++ b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java @@ -215,7 +215,8 @@ public class HttpTransportOverHTTP2 implements HttpTransport // Consume the existing queued data frames to // avoid stalling the session flow control. HttpChannelOverHTTP2 channel = (HttpChannelOverHTTP2)stream.getAttribute(IStream.CHANNEL_ATTRIBUTE); - channel.consumeInput(); + if (channel != null) + channel.consumeInput(); } @Override