public boolean evaluate(Context context, Writer writer,
String logTag, Reader reader)
throws ParseErrorException, MethodInvocationException,
ResourceNotFoundException,IOException
{
SimpleNode nodeTree = null;
try
{
nodeTree = ri.parse(reader, logTag);
}
catch (ParseException pex)
{
throw new ParseErrorException( pex );
}
/*
* now we want to init and render
*/
if (nodeTree != null)
{
InternalContextAdapterImpl ica =
new InternalContextAdapterImpl( context );
ica.pushCurrentTemplateName( logTag );
try
{
try
{
nodeTree.init( ica, ri );
}
/**
* pass through application level runtime exceptions
*/
catch( RuntimeException e )
{
throw e;
}
catch(Exception e)
{
getLog().error("Velocity.evaluate() : init exception for tag = "
+ logTag, e);
}
/*
* now render, and let any exceptions fly
*/
nodeTree.render( ica, writer );
}
finally
{
ica.popCurrentTemplateName();
}