Author: remy.maucherat(a)jboss.com
Date: 2012-04-06 11:40:00 -0400 (Fri, 06 Apr 2012)
New Revision: 2017
Modified:
trunk/java/org/apache/jasper/compiler/Validator.java
trunk/java/org/apache/jasper/runtime/JspApplicationContextImpl.java
trunk/webapps/docs/changelog.xml
Log:
Use per webapp expression factory.
Modified: trunk/java/org/apache/jasper/compiler/Validator.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/Validator.java 2012-04-03 03:42:15 UTC (rev
2016)
+++ trunk/java/org/apache/jasper/compiler/Validator.java 2012-04-06 15:40:00 UTC (rev
2017)
@@ -27,6 +27,7 @@
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.JspFragment;
import javax.servlet.jsp.tagext.PageData;
@@ -37,7 +38,6 @@
import javax.servlet.jsp.tagext.TagLibraryInfo;
import javax.servlet.jsp.tagext.ValidationMessage;
-import org.apache.el.lang.ELSupport;
import org.apache.jasper.JasperException;
import org.apache.jasper.el.ELContextImpl;
import org.xml.sax.Attributes;
@@ -497,8 +497,7 @@
new JspUtil.ValidAttribute("doctype-public"),
new JspUtil.ValidAttribute("doctype-system") };
- private static final ExpressionFactory EXPRESSION_FACTORY =
- ExpressionFactory.newInstance();
+ private final ExpressionFactory expressionFactory;
/*
* Constructor
@@ -507,6 +506,11 @@
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();
}
public void visit(Node.JspRoot n) throws JasperException {
@@ -1166,7 +1170,7 @@
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: trunk/java/org/apache/jasper/runtime/JspApplicationContextImpl.java
===================================================================
--- trunk/java/org/apache/jasper/runtime/JspApplicationContextImpl.java 2012-04-03
03:42:15 UTC (rev 2016)
+++ trunk/java/org/apache/jasper/runtime/JspApplicationContextImpl.java 2012-04-06
15:40:00 UTC (rev 2017)
@@ -50,8 +50,8 @@
private final static String KEY = JspApplicationContextImpl.class.getName();
- private final static ExpressionFactory expressionFactory =
- ExpressionFactory.newInstance();
+ private final ExpressionFactory expressionFactory =
+ ExpressionFactory.newInstance();
private final List<ELContextListener> contextListeners = new
ArrayList<ELContextListener>();
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2012-04-03 03:42:15 UTC (rev 2016)
+++ trunk/webapps/docs/changelog.xml 2012-04-06 15:40:00 UTC (rev 2017)
@@ -41,6 +41,9 @@
<fix>
<bug>52970</bug>: Fix enum as method invocation argument in EL.
(markt)
</fix>
+ <fix>
+ Use per webapp expression factory. (markt)
+ </fix>
</changelog>
</subsection>
</section>
Show replies by date