aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/handler
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/handler')
-rw-r--r--src/main/java/org/traccar/handler/ComputedAttributesHandler.java13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/main/java/org/traccar/handler/ComputedAttributesHandler.java b/src/main/java/org/traccar/handler/ComputedAttributesHandler.java
index 24d853bbe..29d9bcdcb 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,14 +66,10 @@ public class ComputedAttributesHandler extends BaseDataHandler {
JexlSandbox sandbox = new JexlSandbox(false);
sandbox.allow("com.safe.Functions");
sandbox.allow(Math.class.getName());
- sandbox.allow(Double.class.getName());
- sandbox.allow(Float.class.getName());
- sandbox.allow(Integer.class.getName());
- sandbox.allow(Long.class.getName());
- sandbox.allow(Short.class.getName());
- sandbox.allow(Character.class.getName());
- sandbox.allow(Boolean.class.getName());
- sandbox.allow(String.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))