aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2023-06-15 11:27:49 -0700
committerGitHub <noreply@github.com>2023-06-15 11:27:49 -0700
commit2d66dabcf54eb37bafe68f464f386f13a8f1cab6 (patch)
tree0017d2caa8b1b9dd4a67661969680f562c5eee1b
parent4a64ef748e207406be4f7aa7538d59b7b0f9735c (diff)
parent2275e7d4e739eab9e24eab66d068cf0afafc5bb8 (diff)
downloadtrackermap-server-2d66dabcf54eb37bafe68f464f386f13a8f1cab6.tar.gz
trackermap-server-2d66dabcf54eb37bafe68f464f386f13a8f1cab6.tar.bz2
trackermap-server-2d66dabcf54eb37bafe68f464f386f13a8f1cab6.zip
Merge pull request #5122 from memesaregood1/master
Allow primitive Java types in JEXL Engine
-rw-r--r--src/main/java/org/traccar/handler/ComputedAttributesHandler.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/handler/ComputedAttributesHandler.java b/src/main/java/org/traccar/handler/ComputedAttributesHandler.java
index d384bbffc..8ad4e41e4 100644
--- a/src/main/java/org/traccar/handler/ComputedAttributesHandler.java
+++ b/src/main/java/org/traccar/handler/ComputedAttributesHandler.java
@@ -24,6 +24,7 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import java.util.List;
import io.netty.channel.ChannelHandler;
import org.apache.commons.jexl3.JexlFeatures;
@@ -65,6 +66,10 @@ public class ComputedAttributesHandler extends BaseDataHandler {
JexlSandbox sandbox = new JexlSandbox(false);
sandbox.allow("com.safe.Functions");
sandbox.allow(Math.class.getName());
+ List.of(
+ Double.class, Float.class, Integer.class, Long.class, Short.class,
+ Character.class, Boolean.class, String.class, Byte.class)
+ .forEach((type) -> sandbox.allow(type.getName()));
features = new JexlFeatures()
.localVar(config.getBoolean(Keys.PROCESSING_COMPUTED_ATTRIBUTES_LOCAL_VARIABLES))
.loops(config.getBoolean(Keys.PROCESSING_COMPUTED_ATTRIBUTES_LOOPS))