StringWriter writer = new StringWriter();
StringBucket bucket = null;
try {
template.render(templateContext, writer);
bucket = new StringBucket(writer.toString(), utf8Charset);
return new ManifestElement(name, bucket, contentType, bucket.size());
} catch (TemplateException te1) {
logger.log(Level.SEVERE, String.format("Could not render template ā%sā!", templateName), te1);
return null;
} finally {
Closer.close(writer);