Skip to content

Commit

Permalink
updating the ScriptManager class
Browse files Browse the repository at this point in the history
  • Loading branch information
laminba2003 committed Nov 28, 2019
1 parent b24b38e commit 2ec1ce8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/org/gservlet/ScriptManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.io.ByteArrayInputStream;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand All @@ -36,15 +37,15 @@ public class ScriptManager {
protected final GroovyScriptEngine engine;
protected final Logger logger = Logger.getLogger(ScriptManager.class.getName());

public ScriptManager(File folder) throws Exception {
public ScriptManager(File folder) throws MalformedURLException {
engine = createScriptEngine(folder);
}

public Object loadScript(String name) throws Exception {
return engine.loadScriptByName(name).newInstance();
}

protected GroovyScriptEngine createScriptEngine(File folder) throws Exception {
protected GroovyScriptEngine createScriptEngine(File folder) throws MalformedURLException {
URL[] urls = { folder.toURI().toURL(),
ScriptManager.class.getClassLoader().getResource(Constants.SCRIPTS_FOLDER) };
GroovyScriptEngine gse = new GroovyScriptEngine(urls, this.getClass().getClassLoader());
Expand Down

0 comments on commit 2ec1ce8

Please sign in to comment.