if (StringUtils.isEmpty(name))
{
throw new ResourceNotFoundException("No template name provided");
}
StringResource resource = getRepository().getStringResource(name);
if(resource == null)
{
throw new ResourceNotFoundException("Could not locate resource '" + name + "'");
}
byte [] byteArray = null;
try
{
byteArray = resource.getBody().getBytes(resource.getEncoding());
return new ByteArrayInputStream(byteArray);
}
catch(UnsupportedEncodingException ue)
{
throw new VelocityException("Could not convert String using encoding " + resource.getEncoding(), ue);
}
}