Skip to content

Commit

Permalink
use nashorn differently
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmay48 committed Sep 13, 2023
1 parent b76c659 commit cfa1591
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@

import javax.script.Bindings;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

import org.openjdk.nashorn.api.scripting.NashornScriptEngineFactory;

public class ScriptEvaluator {

private static ScriptEngine engine;
Expand Down Expand Up @@ -47,7 +46,7 @@ public static Boolean evalBool(String script, Object input) throws ScriptExcepti
*/
public static Object eval(String script, Object input) throws ScriptException {
if (engine == null) {
engine = new NashornScriptEngineFactory().getScriptEngine();
engine = new ScriptEngineManager().getEngineByName("Nashorn");
}
if (engine == null) {
throw new RuntimeException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

import javax.script.Bindings;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

import org.openjdk.nashorn.api.scripting.NashornScriptEngineFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -100,7 +100,7 @@ public String getExpression() {
* @return
*/
public Javascript validate() {
ScriptEngine scriptEngine = new NashornScriptEngineFactory().getScriptEngine();
ScriptEngine scriptEngine = new ScriptEngineManager().getEngineByName("Nashorn");
if (scriptEngine == null) {
LOGGER.error("missing " + ENGINE + " engine. Ensure you are running supported JVM");
return this;
Expand Down Expand Up @@ -128,7 +128,7 @@ public Javascript validate() {
*/
public Object test(Map<String, Object> input) {

ScriptEngine scriptEngine = new NashornScriptEngineFactory().getScriptEngine();
ScriptEngine scriptEngine = new ScriptEngineManager().getEngineByName("Nashorn");
if (scriptEngine == null) {
LOGGER.error("missing " + ENGINE + " engine. Ensure you are running supported JVM");
return this;
Expand Down
4 changes: 0 additions & 4 deletions server/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,11 @@
<Console name="CONSOLE">
<PatternLayout pattern="%-4r [%t] %-5p %c %x - %m%n"/>
</Console>
<File name="File" filename="../conductor_tests.log">
<PatternLayout pattern="%-4r [%t] %-5p %c %x - %m%n"/>
</File>
</Appenders>

<Loggers>
<Root level="INFO">
<AppenderRef ref="CONSOLE" />
<AppenderRef ref="File" />
</Root>
</Loggers>
</Configuration>

0 comments on commit cfa1591

Please sign in to comment.