in src/main/java/org/apache/sling/scripting/groovy/internal/GStringScriptEngine.java [43:62]
public Object eval(final Reader reader, final ScriptContext scriptContext) throws ScriptException {
final Template template;
try {
template = scriptEngineFactory.getTemplateEngine().createTemplate(reader);
} catch (IOException | ClassNotFoundException e) {
throw new ScriptException("Unable to compile GString template: " + e.getMessage());
}
final Bindings bindings = scriptContext.getBindings(ScriptContext.ENGINE_SCOPE);
final Writer writer = scriptContext.getWriter();
final Writable result = template.make(bindings);
try {
result.writeTo(writer);
} catch (IOException e) {
throw new ScriptException("Unable to write result of script execution: " + e.getMessage());
}
return null;
}