public SimpleNode parse( Reader reader, String templateName, boolean dumpNamespace )
throws ParseException
{
SimpleNode ast = null;
Parser parser = (Parser) parserPool.get();
boolean madeNew = false;
if (parser == null)
{
/*
* if we couldn't get a parser from the pool
* make one and log it.
*/
error("Runtime : ran out of parsers. Creating new. "
+ " Please increment the parser.pool.size property."
+ " The current value is too small.");
parser = createNewParser();
if( parser != null )
{
madeNew = true;
}
}
/*
* now, if we have a parser
*/
if (parser != null)
{
try
{
/*
* dump namespace if we are told to. Generally, you want to
* do this - you don't in special circumstances, such as
* when a VM is getting init()-ed & parsed
*/
if ( dumpNamespace )
{
dumpVMNamespace( templateName );
}
ast = parser.parse( reader, templateName );
}
finally
{
/*
* if this came from the pool, then put back