try {
if (templateFilter != null) {
source = templateFilter.filter(resource.getName(), source);
}
Node root = templateParser.parse(source, 0);
Map<String, Class<?>> parameterTypes = useRenderVariableType && args != null ? new DelegateMap<String, Class<?>>(new TypeMap(convertMap(args))) : null;
Template template = translator.translate(resource, root, parameterTypes);
if (logger != null && logger.isDebugEnabled()) {
logger.debug("Parsed the template " + name + ", eslapsed: " + (System.currentTimeMillis() - start) + "ms.");
}
return template;