@Test (expected = EvaluatorException.class) public void testCompileInvalideJS () throws ScriptLoadException { JSRhinoScriptEngine engine = new JSRhinoScriptEngine(); assertNull(engine.scripts.get("test")); engine.compile("test", "va test = 2;"); }
@Override public void compile(String scriptName, String programStr) throws ScriptLoadException { String fileDir = this.getRelativeFileDir(scriptName); programStr = "var relDir = \"" + fileDir + "\";\n" + programStr; Script script = this.cx.compileString(programStr, scriptName, 1 - 2, null); this.scripts.put(scriptName, script); }
JSRhinoScriptEngine implements IScriptEngine { @Override public void compile(String scriptName, String programStr) throws ScriptLoadException { String fileDir = this.getRelativeFileDir(scriptName); programStr = "var relDir = \"" + fileDir + "\";\n" + programStr; Script script = this.cx.compileString(programStr, scriptName, 1 - 2, null); this.scripts.put(scriptName, script); } }
JSRhinoScriptEngine implements IScriptEngine { @Override public void compile(String scriptName, String programStr) throws ScriptLoadException { String fileDir = this.getRelativeFileDir(scriptName); programStr = "var relDir = \"" + fileDir + "\";\n" + programStr; Script script = this.cx.compileString(programStr, scriptName, 1 - 2, null); this.scripts.put(scriptName, script); } JSRhinoScriptEngine(); }
JSRhinoScriptEngine implements IScriptEngine { @Override public void compile(String scriptName, String programStr) throws ScriptLoadException { String fileDir = this.getRelativeFileDir(scriptName); programStr = "var relDir = \"" + fileDir + "\";\n" + programStr; Script script = this.cx.compileString(programStr, scriptName, 1 - 2, null); this.scripts.put(scriptName, script); } JSRhinoScriptEngine(); @Override void compile(String scriptName, String programStr); @Override void loadFile(File file); @Override Object execFunc(String funcName, Object... args); @Override Object execFunc(String funcName); @Override Object execScript(String scriptName, Object... args); @Override void shutdown(); }
JSRhinoScriptEngine implements IScriptEngine { @Override public void compile(String scriptName, String programStr) throws ScriptLoadException { String fileDir = this.getRelativeFileDir(scriptName); programStr = "var relDir = \"" + fileDir + "\";\n" + programStr; Script script = this.cx.compileString(programStr, scriptName, 1 - 2, null); this.scripts.put(scriptName, script); } JSRhinoScriptEngine(); @Override void compile(String scriptName, String programStr); @Override void loadFile(File file); @Override Object execFunc(String funcName, Object... args); @Override Object execFunc(String funcName); @Override Object execScript(String scriptName, Object... args); @Override void shutdown();  }