Fix bug in GroovyTemplate convenience

It was ignoring the engine argument in the 3 arg version
of template().
This commit is contained in:
Dave Syer 2014-05-30 11:31:51 +01:00
parent b0579c1cf3
commit ed15f742fd
1 changed files with 2 additions and 3 deletions

View File

@ -49,15 +49,14 @@ public abstract class GroovyTemplate {
public static String template(TemplateEngine engine, String name, Map<String, ?> model)
throws IOException, CompilationFailedException, ClassNotFoundException {
Writable writable = getTemplate(name).make(model);
Writable writable = getTemplate(engine, name).make(model);
StringWriter result = new StringWriter();
writable.writeTo(result);
return result.toString();
}
private static Template getTemplate(String name) throws CompilationFailedException,
private static Template getTemplate(TemplateEngine engine, String name) throws CompilationFailedException,
ClassNotFoundException, IOException {
GStringTemplateEngine engine = new GStringTemplateEngine();
File file = new File("templates", name);
if (file.exists()) {