Skip to content

Commit

Permalink
Insert context keys before compiling UI scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Jimmy Tanagra <[email protected]>
  • Loading branch information
jimtng committed Sep 9, 2024
1 parent 1145613 commit a04ec40
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ protected void compileScript() throws ScriptException {
ScriptEngine scriptEngine = engine.get();
if (scriptEngine instanceof Compilable) {
logger.debug("Pre-compiling script of rule with UID '{}'", ruleUID);
setExecutionContext(scriptEngine, Map.of()); // JRuby script engine needs this before compiling
compiledScript = Optional.ofNullable(((Compilable) scriptEngine).compile(script));
}
}
Expand Down Expand Up @@ -211,7 +212,7 @@ protected void resetExecutionContext(ScriptEngine engine, Map<String, ?> context
try {
if (compiledScript.isPresent()) {
logger.debug("Executing pre-compiled script of rule with UID '{}'", ruleUID);
return compiledScript.get().eval(engine.getContext());
return compiledScript.get().eval();
}
logger.debug("Executing script of rule with UID '{}'", ruleUID);
return engine.eval(script);
Expand Down

0 comments on commit a04ec40

Please sign in to comment.