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:57:24 UTC

[unomi] branch unomi-1.5.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.5.x
in repository https://gitbox.apache.org/repos/asf/unomi.git


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

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