diff --git a/java/org/apache/coyote/http11/Http11InputBuffer.java b/java/org/apache/coyote/http11/Http11InputBuffer.java index 2e6d0e885a73..13a174c48063 100644 --- a/java/org/apache/coyote/http11/Http11InputBuffer.java +++ b/java/org/apache/coyote/http11/Http11InputBuffer.java @@ -250,7 +250,10 @@ void recycle() { activeFilters[i].recycle(); } - byteBuffer.limit(0).position(0); + // Avoid rare NPE reported on users@ list + if (byteBuffer != null) { + byteBuffer.limit(0).position(0); + } lastActiveFilter = -1; swallowInput = true; diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 1be5e1afa25e..3813dfa7f5e5 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -124,6 +124,10 @@ Don't log warnings for registered HTTP/2 settings that Tomcat does not support. These settings are now silently ignored. (markt) + + Avoid a rare NullPointerException when recycling the + Http11InputBuffer. (markt) +