You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2012/03/30 21:32:02 UTC

svn commit: r1307579 - in /tomcat/trunk/java/org/apache/jasper: compiler/Validator.java runtime/JspApplicationContextImpl.java

Author: markt
Date: Fri Mar 30 19:32:01 2012
New Revision: 1307579

URL: http://svn.apache.org/viewvc?rev=1307579&view=rev
Log:
Remove static references to ExpressionFactory. These should be per web application.

Modified:
    tomcat/trunk/java/org/apache/jasper/compiler/Validator.java
    tomcat/trunk/java/org/apache/jasper/runtime/JspApplicationContextImpl.java

Modified: tomcat/trunk/java/org/apache/jasper/compiler/Validator.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Validator.java?rev=1307579&r1=1307578&r2=1307579&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Validator.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Validator.java Fri Mar 30 19:32:01 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/trunk/java/org/apache/jasper/runtime/JspApplicationContextImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/JspApplicationContextImpl.java?rev=1307579&r1=1307578&r2=1307579&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/JspApplicationContextImpl.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/JspApplicationContextImpl.java Fri Mar 30 19:32:01 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>();
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org