Author: markt Date: Fri Jul 17 20:12:49 2009 New Revision: 795210 URL: http://svn.apache.org/viewvc?rev=795210&view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=41661 Thread safety issue with JspConfig.init(). There is one JspConfig object per context and as per 41661, issues have been seen with this on real systems.
Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspConfig.java Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspConfig.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspConfig.java?rev=795210&r1=795209&r2=795210&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/compiler/JspConfig.java (original) +++ tomcat/trunk/java/org/apache/jasper/compiler/JspConfig.java Fri Jul 17 20:12:49 2009 @@ -48,7 +48,7 @@ private Vector<JspPropertyGroup> jspProperties = null; private ServletContext ctxt; - private boolean initialized = false; + private volatile boolean initialized = false; private String defaultIsXml = null; // unspecified private String defaultIsELIgnored = null; // unspecified @@ -218,13 +218,17 @@ private void init() throws JasperException { if (!initialized) { - processWebDotXml(ctxt); - defaultJspProperty = new JspProperty(defaultIsXml, - defaultIsELIgnored, - defaultIsScriptingInvalid, - null, null, null, defaultDeferedSyntaxAllowedAsLiteral, - defaultTrimDirectiveWhitespaces); - initialized = true; + synchronized (this) { + if (!initialized) { + processWebDotXml(ctxt); + defaultJspProperty = new JspProperty(defaultIsXml, + defaultIsELIgnored, + defaultIsScriptingInvalid, + null, null, null, defaultDeferedSyntaxAllowedAsLiteral, + defaultTrimDirectiveWhitespaces); + initialized = true; + } + } } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org