}
} finally {
IOUtils.closeQuietly(fileReader);
}
} else {
throw new ScriptException("Script file '"+scriptFile.getAbsolutePath()+"' does not exist or is unreadable for element:"+getName());
}
} else if (!StringUtils.isEmpty(getScript())){
if (supportsCompilable && !StringUtils.isEmpty(cacheKey)) {
CompiledScript compiledScript =
compiledScriptsCache.get(cacheKey);
if (compiledScript==null) {
synchronized (compiledScriptsCache) {
compiledScript =
compiledScriptsCache.get(cacheKey);
if (compiledScript==null) {
compiledScript =
((Compilable) scriptEngine).compile(getScript());
compiledScriptsCache.put(cacheKey, compiledScript);
}
}
}
return compiledScript.eval(bindings);
} else {
return scriptEngine.eval(getScript(), bindings);
}
} else {
throw new ScriptException("Both script file and script text are empty for element:"+getName());
}
}