This is an automated email from the ASF dual-hosted git repository.

rmaucher 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 bf936528f0 TagPluginManager init needs to be thread safe
bf936528f0 is described below

commit bf936528f03a1fcaf208668a72379796f23e7648
Author: remm <[email protected]>
AuthorDate: Mon Jun 1 09:38:14 2026 +0200

    TagPluginManager init needs to be thread safe
---
 java/org/apache/jasper/compiler/TagPluginManager.java | 8 +++++---
 webapps/docs/changelog.xml                            | 3 +++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/jasper/compiler/TagPluginManager.java 
b/java/org/apache/jasper/compiler/TagPluginManager.java
index ca75f4850a..ab88b458b7 100644
--- a/java/org/apache/jasper/compiler/TagPluginManager.java
+++ b/java/org/apache/jasper/compiler/TagPluginManager.java
@@ -40,7 +40,7 @@ public class TagPluginManager {
     private static final String TAG_PLUGINS_XML = "/WEB-INF/tagPlugins.xml";
     private final ServletContext ctxt;
     private HashMap<String,TagPlugin> tagPlugins;
-    private boolean initialized = false;
+    private volatile boolean initialized = false;
 
     /**
      * Creates a new TagPluginManager for the given servlet context.
@@ -61,13 +61,15 @@ public class TagPluginManager {
      */
     public void apply(Node.Nodes page, ErrorDispatcher err, PageInfo pageInfo) 
throws JasperException {
 
-        init(err);
+        if (!initialized) {
+            init(err);
+        }
         if (!tagPlugins.isEmpty()) {
             page.visit(new NodeVisitor(this, pageInfo));
         }
     }
 
-    private void init(ErrorDispatcher err) throws JasperException {
+    private synchronized void init(ErrorDispatcher err) throws JasperException 
{
         if (initialized) {
             return;
         }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 3f2d172dcd..cae470a667 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -445,6 +445,9 @@
       <fix>
         Fix possible EL argument mismatch when it was set to null. (remm)
       </fix>
+      <fix>
+        Fix thread safety of <code>TagPluginManager</code>. (remm)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Cluster">


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to