Author: markt Date: Fri Mar 30 19:33:52 2012 New Revision: 1307581 URL: http://svn.apache.org/viewvc?rev=1307581&view=rev Log: Partial fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=52998 Remove static references to ExpressionFactory. These should be per web application.
Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/Validator.java tomcat/tc7.0.x/trunk/java/org/apache/jasper/runtime/JspApplicationContextImpl.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/ ------------------------------------------------------------------------------ Merged /tomcat/trunk:r1307579 Modified: tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/Validator.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/Validator.java?rev=1307581&r1=1307580&r2=1307581&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/Validator.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/Validator.java Fri Mar 30 19:33:52 2012 @@ -27,6 +27,7 @@ import java.util.Locale; import javax.el.ELException; import javax.el.ExpressionFactory; import javax.el.FunctionMapper; +import javax.servlet.jsp.JspFactory; import javax.servlet.jsp.tagext.FunctionInfo; import javax.servlet.jsp.tagext.PageData; import javax.servlet.jsp.tagext.TagAttributeInfo; @@ -500,8 +501,7 @@ class Validator { new JspUtil.ValidAttribute("doctype-public"), new JspUtil.ValidAttribute("doctype-system") }; - private static final ExpressionFactory EXPRESSION_FACTORY = - ExpressionFactory.newInstance(); + private final ExpressionFactory expressionFactory; /* * Constructor @@ -510,6 +510,11 @@ class Validator { this.pageInfo = compiler.getPageInfo(); this.err = compiler.getErrorDispatcher(); this.loader = compiler.getCompilationContext().getClassLoader(); + // Get the cached EL expression factory for this context + expressionFactory = + JspFactory.getDefaultFactory().getJspApplicationContext( + compiler.getCompilationContext().getServletContext()). + getExpressionFactory(); } @Override @@ -1177,7 +1182,7 @@ class Validator { Boolean.TYPE == expectedClass || expectedClass.isEnum()) { try { - EXPRESSION_FACTORY.coerceToType(attrs.getValue(i), expectedClass); + expressionFactory.coerceToType(attrs.getValue(i), expectedClass); } catch (Exception e) { err.jspError (n, "jsp.error.coerce_to_type", Modified: tomcat/tc7.0.x/trunk/java/org/apache/jasper/runtime/JspApplicationContextImpl.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/runtime/JspApplicationContextImpl.java?rev=1307581&r1=1307580&r2=1307581&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/jasper/runtime/JspApplicationContextImpl.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/jasper/runtime/JspApplicationContextImpl.java Fri Mar 30 19:33:52 2012 @@ -50,8 +50,8 @@ public class JspApplicationContextImpl i private static final String KEY = JspApplicationContextImpl.class.getName(); - private static final ExpressionFactory expressionFactory = - ExpressionFactory.newInstance(); + private final ExpressionFactory expressionFactory = + ExpressionFactory.newInstance(); private final List<ELContextListener> contextListeners = new ArrayList<ELContextListener>(); Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1307581&r1=1307580&r2=1307581&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri Mar 30 19:33:52 2012 @@ -214,6 +214,11 @@ via EL. (markt) </fix> <fix> + <bug>52998</bug>: Partial fix. Remove static references to the EL + expression factory and use per web application references instead. + (markt) + </fix> + <fix> <bug>53001</bug>: Revert the fix for <bug>46915</bug> since the use case described in the bug is invalid since it breaks the EL specification. (markt) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org