* @param fn
* @return the velocity template
* @throws Exception
*/
private Template getTemplate(String[] path, String fn) throws Exception {
ResourceNotFoundException rnfe = null;
for (String p : path) {
if (p == null)
continue;
// System.out.println( "trying to load template "+(p+fn) );
try {
if (Velocity.resourceExists(p + fn))
return Velocity.getTemplate(p + fn);
} catch (ResourceNotFoundException e) {
rnfe = e;
} catch (Exception e) {
System.out.println("ignoring " + e);
}
}
if (rnfe != null)
throw rnfe;
throw new ResourceNotFoundException("could not find resource: " + fn);
}