You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by sh...@apache.org on 2020/11/16 19:25:13 UTC

[unomi] branch master updated: UNOMI-401: correctly set ClassLoader before MVEL script execute (#215)

This is an automated email from the ASF dual-hosted git repository.

shuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/unomi.git


The following commit(s) were added to refs/heads/master by this push:
     new ad122c5  UNOMI-401: correctly set ClassLoader before MVEL script execute (#215)
ad122c5 is described below

commit ad122c5e39a7dcb256c2f251e1f16c665ba90e15
Author: kevan Jahanshahi <ke...@jahia.com>
AuthorDate: Mon Nov 16 20:24:53 2020 +0100

    UNOMI-401: correctly set ClassLoader before MVEL script execute (#215)
---
 .../src/main/java/org/apache/unomi/scripting/MvelScriptExecutor.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripting/src/main/java/org/apache/unomi/scripting/MvelScriptExecutor.java b/scripting/src/main/java/org/apache/unomi/scripting/MvelScriptExecutor.java
index f0fdd51..8777b0f 100644
--- a/scripting/src/main/java/org/apache/unomi/scripting/MvelScriptExecutor.java
+++ b/scripting/src/main/java/org/apache/unomi/scripting/MvelScriptExecutor.java
@@ -44,12 +44,13 @@ public class MvelScriptExecutor implements ScriptExecutor {
 
         final ClassLoader tccl = Thread.currentThread().getContextClassLoader();
         try {
+            Thread.currentThread().setContextClassLoader(secureFilteringClassLoader);
+
             if (!mvelExpressions.containsKey(script)) {
 
                 if (expressionFilterFactory.getExpressionFilter("mvel").filter(script) == null) {
                     mvelExpressions.put(script, INVALID_SCRIPT_MARKER);
                 } else {
-                    Thread.currentThread().setContextClassLoader(secureFilteringClassLoader);
                     ParserConfiguration parserConfiguration = new ParserConfiguration();
                     parserConfiguration.setClassLoader(secureFilteringClassLoader);
                     ParserContext parserContext = new ParserContext(parserConfiguration);