Skip to content

Commit e3049f3

Browse files
author
Marcel Overdijk
committed
Fixed #44 for not able to get JavaScript in Google App Engine local devserver
1 parent 42ee9c6 commit e3049f3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

rivescript-core/src/main/java/com/rivescript/lang/jsr223/Jsr223ScriptingHandler.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,15 @@ public Jsr223ScriptingHandler(String engineName, String functionCodeFormat, Stri
8585
*/
8686
public Jsr223ScriptingHandler(String engineName, String functionCodeFormat, String functionNamePrefix, String codeDelimiter) {
8787
this.engineName = requireNonNull(engineName, "'engineName' must not be null");
88-
this.scriptEngine = new ScriptEngineManager().getEngineByName(engineName);
8988
this.functionNamePrefix = requireNonNull(functionNamePrefix, "'functionNamePrefix' must not be null");
9089
this.functionCodeFormat = requireNonNull(functionCodeFormat, "'functionCodeFormat' must not be null");
9190
this.codeDelimiter = requireNonNull(codeDelimiter, "'codeDelimiter' must not be null");
91+
this.scriptEngine = new ScriptEngineManager().getEngineByName(engineName);
9292
if (this.scriptEngine == null) {
93-
logger.error("No script engine found for '{}'", engineName);
93+
this.scriptEngine = new ScriptEngineManager(null).getEngineByName(engineName);
94+
if (this.scriptEngine == null) {
95+
logger.error("No script engine found for '{}'", engineName);
96+
}
9497
}
9598
}
9699

0 commit comments

Comments
 (0)