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

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

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

jkevan pushed a commit to branch unomi-1.4.x
in repository https://gitbox.apache.org/repos/asf/unomi.git


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

commit e6dd1f45da4f48c9adea44fde8fe0e7c7734dbc1
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);