Author: markt Date: Fri Feb 13 12:33:48 2015 New Revision: 1659538 URL: http://svn.apache.org/r1659538 Log: Backport some Jasper clean-up that might provide a marginal performance improvement. Even if it doesn't it removes some unnecessary code.
Modified: tomcat/tc6.0.x/trunk/STATUS.txt tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/PageContextImpl.java tomcat/tc6.0.x/trunk/java/org/apache/jasper/security/SecurityClassLoad.java Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1659538&r1=1659537&r2=1659538&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Fri Feb 13 12:33:48 2015 @@ -34,18 +34,6 @@ PATCHES PROPOSED TO BACKPORT: +1: kkolinko, remm, markt -1: -* Backport some Jasper clean-up that might provide a marginal performance - improvement. Even if it doesn't it removes some unnecessary code - http://people.apache.org/~markt/patches/2015-02-06-jasper-cleanup-tc6-v1.patch - +1: markt, kkolinko, remm - -1: - - Additional change from r1645644 is needed: - Otherwise it logs a SEVERE message at startup - http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/security/SecurityClassLoad.java?r1=1645644&r2=1645643&pathrev=1645644 - +1: kkolinko, remm, markt - -1: - * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57544 Avoid potential infinite loop. Chances are this is only triggered by code (WebSocket, non-blocking, async) that isn't in 6.0.x but better to clean it up Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/PageContextImpl.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/PageContextImpl.java?rev=1659538&r1=1659537&r2=1659538&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/PageContextImpl.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/PageContextImpl.java Fri Feb 13 12:33:48 2015 @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -59,7 +59,7 @@ import org.apache.jasper.util.Enumerator /** * Implementation of the PageContext class from the JSP spec. Also doubles as a * VariableResolver for the EL. - * + * * @author Anil K. Vijendran * @author Larry Cable * @author Hans Bergsten @@ -70,7 +70,7 @@ import org.apache.jasper.util.Enumerator */ public class PageContextImpl extends PageContext { - private static final JspFactory jspf = JspFactory.getDefaultFactory(); + private static final JspFactory jspf = JspFactory.getDefaultFactory(); private BodyContentImpl[] outs; @@ -96,12 +96,12 @@ public class PageContextImpl extends Pag private transient ServletResponse response; private transient HttpSession session; - + private transient ELContextImpl elContext; private boolean isIncluded; - - + + // initial output stream private transient JspWriter out; @@ -137,7 +137,7 @@ public class PageContextImpl extends Pag this.errorPageURL = errorPageURL; this.request = request; this.response = response; - + // initialize application context this.applicationContext = JspApplicationContextImpl.getInstance(context); @@ -589,7 +589,7 @@ public class PageContextImpl extends Pag * Returns the exception associated with this page context, if any. <p/> * Added wrapping for Throwables to avoid ClassCastException: see Bugzilla * 31171 for details. - * + * * @return The Exception associated with this page context, if any. */ public Exception getException() { @@ -875,7 +875,7 @@ public class PageContextImpl extends Pag * go away once the EL interpreter moves out of JSTL and into its own * project. For now, this is necessary because the standard machinery is too * slow. - * + * * @param expression * The expression to be evaluated * @param expectedType @@ -887,39 +887,14 @@ public class PageContextImpl extends Pag * @return The result of the evaluation */ public static Object proprietaryEvaluate(final String expression, - final Class expectedType, final PageContext pageContext, + final Class<?> expectedType, final PageContext pageContext, final ProtectedFunctionMapper functionMap, final boolean escape) throws ELException { - Object retValue; final ExpressionFactory exprFactory = jspf.getJspApplicationContext(pageContext.getServletContext()).getExpressionFactory(); - if (SecurityUtil.isPackageProtectionEnabled()) { - try { - retValue = AccessController - .doPrivileged(new PrivilegedExceptionAction() { - - public Object run() throws Exception { - ELContextImpl ctx = (ELContextImpl) pageContext.getELContext(); - ctx.setFunctionMapper(new FunctionMapperImpl(functionMap)); - ValueExpression ve = exprFactory.createValueExpression(ctx, expression, expectedType); - return ve.getValue(ctx); - } - }); - } catch (PrivilegedActionException ex) { - Exception realEx = ex.getException(); - if (realEx instanceof ELException) { - throw (ELException) realEx; - } else { - throw new ELException(realEx); - } - } - } else { - ELContextImpl ctx = (ELContextImpl) pageContext.getELContext(); - ctx.setFunctionMapper(new FunctionMapperImpl(functionMap)); - ValueExpression ve = exprFactory.createValueExpression(ctx, expression, expectedType); - retValue = ve.getValue(ctx); - } - - return retValue; + ELContextImpl ctx = (ELContextImpl) pageContext.getELContext(); + ctx.setFunctionMapper(new FunctionMapperImpl(functionMap)); + ValueExpression ve = exprFactory.createValueExpression(ctx, expression, expectedType); + return ve.getValue(ctx); } public ELContext getELContext() { Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/security/SecurityClassLoad.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/security/SecurityClassLoad.java?rev=1659538&r1=1659537&r2=1659538&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/jasper/security/SecurityClassLoad.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/security/SecurityClassLoad.java Fri Feb 13 12:33:48 2015 @@ -93,8 +93,6 @@ public final class SecurityClassLoad { "runtime.PageContextImpl$11"); loader.loadClass( basePackage + "runtime.PageContextImpl$12"); - loader.loadClass( basePackage + - "runtime.PageContextImpl$13"); loader.loadClass( basePackage + "runtime.JspContextWrapper"); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org