if (Logger.isDebugEnabled(this.getClass()))
{
Logger.debug(this,"Creating string repository using class "+className+"...");
}
StringResourceRepository repo;
try
{
repo = (StringResourceRepository) ClassUtils.getNewInstance(className);
}
catch (ClassNotFoundException cnfe)
{
throw new VelocityException("Could not find '" + className + "'", cnfe);
}
catch (IllegalAccessException iae)
{
throw new VelocityException("Could not access '" + className + "'", iae);
}
catch (InstantiationException ie)
{
throw new VelocityException("Could not instantiate '" + className + "'", ie);
}
if (encoding != null)
{
repo.setEncoding(encoding);
}
else
{
repo.setEncoding(REPOSITORY_ENCODING_DEFAULT);
}
if (Logger.isDebugEnabled(this.getClass()))
{
Logger.debug(this,"Default repository encoding is " + repo.getEncoding());
}
return repo;
}