ScriptEngine engine = manager.getEngineByExtension(getFileExtension(filePath));
if (engine == null) {
throw new IllegalArgumentException("The script type is not supported for location: " + filePath);
}
try {
Compilable compilableEngine = (Compilable) engine;
URL scriptUrl = FlexibleLocation.resolveLocation(filePath);
BufferedReader reader = new BufferedReader(new InputStreamReader(scriptUrl.openStream()));
script = compilableEngine.compile(reader);
if (Debug.verboseOn()) {
Debug.logVerbose("Compiled script " + filePath + " using engine " + engine.getClass().getName(), module);
}
} catch (ClassCastException e) {
if (Debug.verboseOn()) {