improve logging for issue 38

This commit is contained in:
Sebastian Sdorra
2011-08-04 11:11:22 +02:00
parent 866bc78b9d
commit 9a399756f9

View File

@@ -42,9 +42,11 @@ import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.ConfigurationException;
import sonia.scm.util.Util;
//~--- JDK imports ------------------------------------------------------------
@@ -57,7 +59,6 @@ import java.util.Locale;
import java.util.Map;
import javax.servlet.ServletContext;
import org.slf4j.Logger;
/**
*
@@ -97,6 +98,18 @@ public class FreemarkerTemplateHandler implements TemplateHandler
String path = servletContext.getRealPath(DIRECTORY_TEMPLATES);
if (logger.isDebugEnabled())
{
logger.debug("configure template handler for directory '{}'",
Util.nonNull(path));
}
if (path == null)
{
throw new ConfigurationException(
"could not resolve template handler path");
}
configuration.setDirectoryForTemplateLoading(new File(path));
configuration.setEncoding(Locale.ENGLISH, ENCODING);
}