Commit ed15f742 authored by Dave Syer's avatar Dave Syer

Fix bug in GroovyTemplate convenience

It was ignoring the engine argument in the 3 arg version
of template().
parent b0579c1c
...@@ -49,15 +49,14 @@ public abstract class GroovyTemplate { ...@@ -49,15 +49,14 @@ public abstract class GroovyTemplate {
public static String template(TemplateEngine engine, String name, Map<String, ?> model) public static String template(TemplateEngine engine, String name, Map<String, ?> model)
throws IOException, CompilationFailedException, ClassNotFoundException { throws IOException, CompilationFailedException, ClassNotFoundException {
Writable writable = getTemplate(name).make(model); Writable writable = getTemplate(engine, name).make(model);
StringWriter result = new StringWriter(); StringWriter result = new StringWriter();
writable.writeTo(result); writable.writeTo(result);
return result.toString(); return result.toString();
} }
private static Template getTemplate(String name) throws CompilationFailedException, private static Template getTemplate(TemplateEngine engine, String name) throws CompilationFailedException,
ClassNotFoundException, IOException { ClassNotFoundException, IOException {
GStringTemplateEngine engine = new GStringTemplateEngine();
File file = new File("templates", name); File file = new File("templates", name);
if (file.exists()) { if (file.exists()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment