From 57364d7d83d1f89e94108d0099c140b985d92829 Mon Sep 17 00:00:00 2001 From: Marcus Warm Date: Fri, 8 Dec 2023 13:30:33 +0100 Subject: [PATCH] JEXL 3.3 --- jxls/build.gradle | 2 +- jxls/pom.xml | 2 +- .../org/jxls/expression/JexlExpressionEvaluator.java | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/jxls/build.gradle b/jxls/build.gradle index ffb41017..428db912 100644 --- a/jxls/build.gradle +++ b/jxls/build.gradle @@ -1,7 +1,7 @@ dependencies { def slf4jVersion = '1.7.30' - api('org.apache.commons:commons-jexl3:3.2') { + api('org.apache.commons:commons-jexl3:3.3') { exclude group: 'commons-logging', module: 'commons-logging' } api('commons-beanutils:commons-beanutils:1.9.4') { diff --git a/jxls/pom.xml b/jxls/pom.xml index c93d1a2e..f50a2452 100644 --- a/jxls/pom.xml +++ b/jxls/pom.xml @@ -11,7 +11,7 @@ Small library for Excel generation based on XLS templates - 3.2 + 3.3 diff --git a/jxls/src/main/java/org/jxls/expression/JexlExpressionEvaluator.java b/jxls/src/main/java/org/jxls/expression/JexlExpressionEvaluator.java index 61aaacc6..71e6f95f 100644 --- a/jxls/src/main/java/org/jxls/expression/JexlExpressionEvaluator.java +++ b/jxls/src/main/java/org/jxls/expression/JexlExpressionEvaluator.java @@ -8,6 +8,7 @@ import org.apache.commons.jexl3.JexlEngine; import org.apache.commons.jexl3.JexlExpression; import org.apache.commons.jexl3.MapContext; +import org.apache.commons.jexl3.introspection.JexlPermissions; /** * JEXL based implementation of {@link ExpressionEvaluator} interface @@ -16,6 +17,7 @@ public class JexlExpressionEvaluator implements ExpressionEvaluator { private final boolean silent; private final boolean strict; + private final JexlPermissions jexlPermissions; private JexlExpression jexlExpression; private JexlContext jexlContext; private static ThreadLocal> jexlThreadLocal = new ThreadLocal>() { @@ -36,8 +38,13 @@ public JexlExpressionEvaluator() { } public JexlExpressionEvaluator(final boolean silent, final boolean strict) { + this(silent, strict, JexlPermissions.UNRESTRICTED); + } + + public JexlExpressionEvaluator(final boolean silent, final boolean strict, final JexlPermissions jexlPermissions) { this.silent = silent; this.strict = strict; + this.jexlPermissions = jexlPermissions; } public JexlExpressionEvaluator(String expression) { @@ -96,7 +103,7 @@ public JexlEngine getJexlEngine() { Map map = jexlThreadLocal.get(); JexlEngine ret = map.get(key); if (ret == null) { - ret = new JexlBuilder().silent(silent).strict(strict).create(); + ret = new JexlBuilder().silent(silent).strict(strict).permissions(jexlPermissions).create(); map.put(key, ret); } return ret;