* to prevent any changes to the current context.
*/
if (nodeTree != null)
{
InternalContextAdapter ica = new EvaluateContext(context, rsvc);
ica.pushCurrentTemplateName( templateName );
try
{
try
{
nodeTree.init( ica, rsvc );
}
catch (TemplateInitException pex)
{
Info info = new Info( templateName, node.getLine(), node.getColumn() );
throw new ParseErrorException( pex.getMessage(), info );
}
try
{
preRender(ica);
/*
* now render, and let any exceptions fly
*/
nodeTree.render( ica, writer );
}
catch (StopCommand stop)
{
if (!stop.isFor(this))
{
throw stop;
}
else if (Logger.isDebugEnabled(this.getClass()))
{
Logger.debug(this,stop.getMessage());
}
}
catch (ParseErrorException pex)
{
// convert any parsing errors to the correct line/col
Info info = new Info( templateName, node.getLine(), node.getColumn() );
throw new ParseErrorException( pex.getMessage(), info );
}
}
finally
{
ica.popCurrentTemplateName();
postRender(ica);
}
return true;
}