NIHVIVO-2470 Restore parameter type checking on DumpDirective and HelpDirective. Handle undefined variables by assigning value = "Undefined."

This commit is contained in:
ryounes 2011-04-20 21:37:12 +00:00
parent 84f779238c
commit d64d45d8e6
4 changed files with 21 additions and 7 deletions

View file

@ -40,8 +40,13 @@ public class HelpDirective extends BaseDumpDirective {
throw new TemplateModelException(
"Must specify 'for' argument.");
}
String varName = params.get("var").toString();
if ( !(o instanceof SimpleScalar)) {
throw new TemplateModelException(
"Value of parameter 'for' must be a string.");
}
String varName = o.toString(); //((SimpleScalar)o).getAsString();
TemplateHashModel dataModel = env.getDataModel();
Object templateModel = dataModel.get(varName);