catch ( Exception e)
{
String msg = "Exception rendering #parse(" + arg + ") at " +
Log.formatFileString(this);
rsvc.getLog().error(msg, e);
throw new VelocityException(msg, e);
}
if (!blockinput)
{
/**
* Add the template name to the macro libraries list
*/
List macroLibraries = context.getMacroLibraries();
/**
* if macroLibraries are not set create a new one
*/
if (macroLibraries == null)
{
macroLibraries = new ArrayList();
}
context.setMacroLibraries(macroLibraries);
macroLibraries.add(arg);
}
/*
* and render it
*/
try
{
if (!blockinput) {
context.pushCurrentTemplateName(arg);
((SimpleNode) t.getData()).render( context, writer );
}
}
/**
* pass through application level runtime exceptions
*/
catch( RuntimeException e )
{
/**
* Log #parse errors so the user can track which file called which.
*/
rsvc.getLog().error("Exception rendering #parse(" + arg + ") at " +
Log.formatFileString(this));
throw e;
}
catch ( Exception e )
{
String msg = "Exception rendering #parse(" + arg + ") at " +
Log.formatFileString(this);
rsvc.getLog().error(msg, e);
throw new VelocityException(msg, e);
}
finally
{
if (!blockinput)
context.popCurrentTemplateName();