Skip to content

Commit

Permalink
Merge pull request #106 from nigelgbanks/54879858-velocity-template-e…
Browse files Browse the repository at this point in the history
…rrors

Resolve velocity template errors on webapp startup
  • Loading branch information
Andrew Woods committed Aug 14, 2013
2 parents 2dc28c5 + dc9bde1 commit d1d16a1
Showing 1 changed file with 9 additions and 16 deletions.
Expand Up @@ -54,7 +54,6 @@
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.context.Context;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.tools.generic.EscapeTool;
import org.apache.velocity.tools.generic.FieldTool;
import org.fcrepo.kernel.RdfLexicon;
Expand All @@ -72,7 +71,7 @@
* A simple JAX-RS Entity Provider that can accept RDF datasets that represent
* Fedora resources and merge them into templates chosen based on the primary
* node type of the backing JCR node for that Fedora resource.
*
*
* @author ajs6f
* @date May 19, 2013
*/
Expand Down Expand Up @@ -136,25 +135,19 @@ void init() throws IOException, RepositoryException {
templatesLocation + "/" +
primaryNodeTypeName.replace(':', '-') +
templateFilenameExtension;
try {
if (velocity.resourceExists(templateLocation)) {
final Template template =
velocity.getTemplate(templateLocation);
velocity.getTemplate(templateLocation);
template.setName(templateLocation);
LOGGER.debug("Found template: {}", templateLocation);
templatesMapBuilder.put(primaryNodeTypeName, template);
LOGGER.debug(
"which we will use for nodes with primary type: {}",
primaryNodeTypeName);
} catch (final ResourceNotFoundException e) {
LOGGER.debug(
"Didn't find template for nodes with primary type: {} in location: {}",
primaryNodeTypeName, templateLocation);
/*
* we don't care-- just means we don't have an HTML
* representation available for that kind of node
*/
LOGGER.debug("which we will use for nodes with primary type: {}",
primaryNodeTypeName);
} else {
// No HTML representation available for that kind of node
LOGGER.debug("Didn't find template for nodes with primary type: {} in location: {}",
primaryNodeTypeName, templateLocation);
}

}

List<String> otherTemplates =
Expand Down

0 comments on commit d1d16a1

Please sign in to comment.