diff --git a/core/src/main/java/org/phoenixctms/ctsms/js/FieldCalculation.java b/core/src/main/java/org/phoenixctms/ctsms/js/FieldCalculation.java index 3c43a8ff1110..f4cc3f8f6ca3 100644 --- a/core/src/main/java/org/phoenixctms/ctsms/js/FieldCalculation.java +++ b/core/src/main/java/org/phoenixctms/ctsms/js/FieldCalculation.java @@ -12,6 +12,7 @@ import javax.script.ScriptEngine; import javax.script.ScriptException; +import org.openjdk.nashorn.api.scripting.JSObject; import org.phoenixctms.ctsms.util.CommonUtil; import org.phoenixctms.ctsms.util.CoreUtil; import org.phoenixctms.ctsms.util.DefaultSettings; @@ -31,8 +32,6 @@ import org.phoenixctms.ctsms.vo.VisitScheduleItemOutVO; import org.springframework.core.io.ClassPathResource; -import jdk.nashorn.api.scripting.JSObject; - @SuppressWarnings("restriction") public class FieldCalculation { diff --git a/core/src/main/java/org/phoenixctms/ctsms/js/JSObjectMap.java b/core/src/main/java/org/phoenixctms/ctsms/js/JSObjectMap.java index 862bec3a9c97..1872d3075e3d 100644 --- a/core/src/main/java/org/phoenixctms/ctsms/js/JSObjectMap.java +++ b/core/src/main/java/org/phoenixctms/ctsms/js/JSObjectMap.java @@ -4,7 +4,7 @@ import java.util.Map; import java.util.Set; -import jdk.nashorn.api.scripting.AbstractJSObject; +import org.openjdk.nashorn.api.scripting.AbstractJSObject; //http://stackoverflow.com/questions/7519399/how-to-convert-java-map-to-a-basic-javascript-object @SuppressWarnings("restriction") diff --git a/core/src/main/java/org/phoenixctms/ctsms/js/ValidationError.java b/core/src/main/java/org/phoenixctms/ctsms/js/ValidationError.java index 097498a5f4f3..a6a829febcfb 100644 --- a/core/src/main/java/org/phoenixctms/ctsms/js/ValidationError.java +++ b/core/src/main/java/org/phoenixctms/ctsms/js/ValidationError.java @@ -1,6 +1,6 @@ package org.phoenixctms.ctsms.js; -import jdk.nashorn.api.scripting.JSObject; +import org.openjdk.nashorn.api.scripting.JSObject; @SuppressWarnings("restriction") public class ValidationError { diff --git a/core/src/main/java/org/phoenixctms/ctsms/util/CoreUtil.java b/core/src/main/java/org/phoenixctms/ctsms/util/CoreUtil.java index 58b3fe365875..129e9dfcf71e 100644 --- a/core/src/main/java/org/phoenixctms/ctsms/util/CoreUtil.java +++ b/core/src/main/java/org/phoenixctms/ctsms/util/CoreUtil.java @@ -40,9 +40,9 @@ import javax.imageio.ImageReader; import javax.imageio.stream.ImageInputStream; import javax.script.ScriptEngine; -import javax.script.ScriptEngineManager; import org.apache.commons.codec.binary.Base64; +import org.openjdk.nashorn.api.scripting.NashornScriptEngineFactory; import org.phoenixctms.ctsms.PrincipalStore; import org.phoenixctms.ctsms.UserContext; import org.phoenixctms.ctsms.compare.AlphanumStringComparator; @@ -81,7 +81,7 @@ public final class CoreUtil implements ApplicationContextAware { public final static String OBFUSCATED_STRING = "********"; public final static String RANDOM_ALGORITHM = "SHA1PRNG"; - private final static String JAVASCRIPT_ENGINE_NAME = "JavaScript"; + //private final static String JAVASCRIPT_ENGINE_NAME = "JavaScript"; public static final String PDF_FILENAME_EXTENSION = "pdf"; public static final String PDF_MIMETYPE_STRING = "application/pdf"; // public for demodataprovider public static final String EXCEL_FILENAME_EXTENSION = "xls"; @@ -665,8 +665,10 @@ public static String getInVOClassNameFromEntityName(String entityName) { } public static ScriptEngine getJsEngine() { - ScriptEngineManager manager = new ScriptEngineManager(); - return manager.getEngineByName(JAVASCRIPT_ENGINE_NAME); + //ScriptEngineManager manager = new ScriptEngineManager(); + //return manager.getEngineByName(JAVASCRIPT_ENGINE_NAME); + NashornScriptEngineFactory factory = new NashornScriptEngineFactory(); + return factory.getScriptEngine(); } public static Password getLastPassword() {