Return-Path: X-Original-To: apmail-struts-commits-archive@minotaur.apache.org Delivered-To: apmail-struts-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8DC781882F for ; Thu, 24 Mar 2016 21:05:24 +0000 (UTC) Received: (qmail 99718 invoked by uid 500); 24 Mar 2016 21:05:24 -0000 Delivered-To: apmail-struts-commits-archive@struts.apache.org Received: (qmail 99681 invoked by uid 500); 24 Mar 2016 21:05:24 -0000 Mailing-List: contact commits-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list commits@struts.apache.org Received: (qmail 99672 invoked by uid 99); 24 Mar 2016 21:05:24 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Mar 2016 21:05:24 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E937BDFC11; Thu, 24 Mar 2016 21:05:23 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: lukaszlenart@apache.org To: commits@struts.apache.org Message-Id: <1b0b3773cd7843f2a768258853f45271@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: struts git commit: WW-4619 Disables EL when not supported by container Date: Thu, 24 Mar 2016 21:05:23 +0000 (UTC) Repository: struts Updated Branches: refs/heads/master 7256557c3 -> f6039d237 WW-4619 Disables EL when not supported by container Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/f6039d23 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/f6039d23 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/f6039d23 Branch: refs/heads/master Commit: f6039d2378aa21734c15949bead1769a5247eeff Parents: 7256557 Author: Lukasz Lenart Authored: Thu Mar 24 22:05:12 2016 +0100 Committer: Lukasz Lenart Committed: Thu Mar 24 22:05:12 2016 +0100 ---------------------------------------------------------------------- .../struts2/tiles/StrutsTilesContainerFactory.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/f6039d23/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesContainerFactory.java ---------------------------------------------------------------------- diff --git a/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesContainerFactory.java b/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesContainerFactory.java index 0cb14f3..fe90d75 100644 --- a/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesContainerFactory.java +++ b/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesContainerFactory.java @@ -22,6 +22,8 @@ package org.apache.struts2.tiles; import ognl.OgnlException; import ognl.OgnlRuntime; import ognl.PropertyAccessor; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.tiles.TilesContainer; import org.apache.tiles.definition.DefinitionsFactory; import org.apache.tiles.definition.pattern.DefinitionPatternMatcherFactory; @@ -63,6 +65,7 @@ import javax.el.ELResolver; import javax.el.ListELResolver; import javax.el.MapELResolver; import javax.el.ResourceBundleELResolver; +import javax.servlet.jsp.JspFactory; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -81,6 +84,8 @@ import java.util.Map; */ public class StrutsTilesContainerFactory extends BasicTilesContainerFactory { + private static final Logger LOG = LogManager.getLogger(StrutsTilesContainerFactory.class); + /** * The freemarker renderer name. */ @@ -144,7 +149,11 @@ public class StrutsTilesContainerFactory extends BasicTilesContainerFactory { BasicAttributeEvaluatorFactory attributeEvaluatorFactory = new BasicAttributeEvaluatorFactory(new DirectAttributeEvaluator()); attributeEvaluatorFactory.registerAttributeEvaluator(OGNL, createOGNLEvaluator()); - attributeEvaluatorFactory.registerAttributeEvaluator(EL, createELEvaluator(applicationContext)); + + ELAttributeEvaluator elEvaluator = createELEvaluator(applicationContext); + if (elEvaluator != null) { + attributeEvaluatorFactory.registerAttributeEvaluator(EL, elEvaluator); + } return attributeEvaluatorFactory; } @@ -189,6 +198,12 @@ public class StrutsTilesContainerFactory extends BasicTilesContainerFactory { } protected ELAttributeEvaluator createELEvaluator(ApplicationContext applicationContext) { + + if (JspFactory.getDefaultFactory() == null) { + LOG.warn("JspFactory.getDefaultFactory returned null, EL support will be disabled"); + return null; + } + ELAttributeEvaluator evaluator = new ELAttributeEvaluator(); JspExpressionFactoryFactory efFactory = new JspExpressionFactoryFactory(); efFactory.setApplicationContext(applicationContext);