diff --git a/java/org/apache/coyote/http11/Http11InputBuffer.java b/java/org/apache/coyote/http11/Http11InputBuffer.java index 689885edb4f2..6ac98ad88d9d 100644 --- a/java/org/apache/coyote/http11/Http11InputBuffer.java +++ b/java/org/apache/coyote/http11/Http11InputBuffer.java @@ -259,7 +259,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 b45debc8186a..b983b43c0cc8 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) +