This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new ede13f817c Review "Avoid NullPointerException releasing a PageContext
..."
ede13f817c is described below
commit ede13f817c7b3561a6e7c771946307ac9a231450
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Nov 6 08:56:43 2026 +0000
Review "Avoid NullPointerException releasing a PageContext ..."
Fix a concurrency issue reading the pool size
---
java/org/apache/jasper/runtime/JspFactoryImpl.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/jasper/runtime/JspFactoryImpl.java
b/java/org/apache/jasper/runtime/JspFactoryImpl.java
index c45b007614..af6f022d63 100644
--- a/java/org/apache/jasper/runtime/JspFactoryImpl.java
+++ b/java/org/apache/jasper/runtime/JspFactoryImpl.java
@@ -48,11 +48,15 @@ public class JspFactoryImpl extends JspFactory {
public PageContext getPageContext(Servlet servlet, ServletRequest request,
ServletResponse response,
String errorPageURL, boolean needsSession, int bufferSize, boolean
autoflush) {
+ // Read the volatile field once. It may be changed concurrently by the
+ // start of another web application.
+ int currentPoolSize = poolSize;
+
PageContext pc;
- if (poolSize > 0) {
+ if (currentPoolSize > 0) {
PageContextPool pool = localPool.get();
if (pool == null) {
- pool = new PageContextPool(poolSize);
+ pool = new PageContextPool(currentPoolSize);
localPool.set(pool);
}
pc = pool.get();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]