*/
boolean blockinput = false;
if (arg == null)
blockinput = true;
Resource resource = null;
try
{
if (!blockinput)
resource = rsvc.getContent(arg, getInputEncoding(context));
}
catch ( ResourceNotFoundException rnfe )
{
/*
* the arg wasn't found. Note it and throw
*/
rsvc.getLog().error("#include(): cannot find resource '" + arg +
"', called from template " +
context.getCurrentTemplateName() + " at (" +
getLine() + ", " + getColumn() + ")" );
throw rnfe;
}
/**
* pass through application level runtime exceptions
*/
catch( RuntimeException e )
{
throw e;
}
catch (Exception e)
{
String msg = "#include(): arg = '" + arg +
"', called from template " +
context.getCurrentTemplateName() + " at (" +
getLine() + ", " + getColumn() + ')';
rsvc.getLog().error(msg, e);
throw new VelocityException(msg, e);
}
/*
* note - a blocked input is still a successful operation as this is
* expected behavior.
*/
if ( blockinput )
return true;
else if ( resource == null )
return false;
writer.write((String)resource.getData());
return true;
}