Author: markt Date: Mon Jul 29 20:55:45 2013 New Revision: 1508196 URL: http://svn.apache.org/r1508196 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55309 Fix concurrency issue in TagPluginManager PageInfo should not be a field as it is per page and there will be conflicts with concurrent compilations. Patch provided by Sheldon Shao.
Modified: tomcat/trunk/java/org/apache/jasper/compiler/TagPluginManager.java Modified: tomcat/trunk/java/org/apache/jasper/compiler/TagPluginManager.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/TagPluginManager.java?rev=1508196&r1=1508195&r2=1508196&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/compiler/TagPluginManager.java (original) +++ tomcat/trunk/java/org/apache/jasper/compiler/TagPluginManager.java Mon Jul 29 20:55:45 2013 @@ -45,7 +45,6 @@ public class TagPluginManager { private boolean initialized = false; private HashMap<String, TagPlugin> tagPlugins = null; private final ServletContext ctxt; - private PageInfo pageInfo; public TagPluginManager(ServletContext ctxt) { this.ctxt = ctxt; @@ -59,17 +58,7 @@ public class TagPluginManager { return; } - this.pageInfo = pageInfo; - - page.visit(new Node.Visitor() { - @Override - public void visit(Node.CustomTag n) - throws JasperException { - invokePlugin(n); - visitBody(n); - } - }); - + page.visit(new NodeVisitor(this, pageInfo)); } private void init(ErrorDispatcher err) throws JasperException { @@ -162,7 +151,7 @@ public class TagPluginManager { * * The given custom tag node will be manipulated by the plugin. */ - private void invokePlugin(Node.CustomTag n) { + private void invokePlugin(Node.CustomTag n, PageInfo pageInfo) { TagPlugin tagPlugin = tagPlugins.get(n.getTagHandlerClass().getName()); if (tagPlugin == null) { return; @@ -173,6 +162,22 @@ public class TagPluginManager { tagPlugin.doTag(tagPluginContext); } + private static class NodeVisitor extends Node.Visitor { + private TagPluginManager manager; + private PageInfo pageInfo; + + public NodeVisitor(TagPluginManager manager, PageInfo pageInfo) { + this.manager = manager; + this.pageInfo = pageInfo; + } + + @Override + public void visit(Node.CustomTag n) throws JasperException { + manager.invokePlugin(n, pageInfo); + visitBody(n); + } + } + private static class TagPluginContextImpl implements TagPluginContext { private final Node.CustomTag node; private Node.Nodes curNodes; --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org