Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.0.2
-
None
Description
Freemarker throws a stack trace when the value for option is null. (This is using a LinkedHashMap as the source for the select list) Just seeing the error, it is hard to figure out what is causing it. Secondly, it seems like the select template should handle this better, like check if the value is null and render an empty select option. (e.g. <option value="">Not a valid selection) This would make it easier to figure out which option is the issue and it wouldn't throw an ugly stacktrace.
This is the resulting freemarker error:
--------------------
Error on line 48, column 13 in template/simple/select.ftl
stack.findString(parameters.listValue) is undefined.
It cannot be assigned to itemValue
The problematic instruction:
----------
==> assignment: itemValue=stack.findString(parameters.listValue) [on line 48, column 13 in template/simple/select.ftl]
in user-directive s.iterator [on line 40, column 1 in template/simple/select.ftl]
in include "/${parameters.templateDir}/simple/select.ftl" [on line 2, column 1 in template/xhtml/select.ftl]
----------
Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Error on line 48, column 13 in template/simple/select.ftl
stack.findString(parameters.listValue) is undefined.
It cannot be assigned to itemValue
at freemarker.core.Assignment.accept(Assignment.java:111)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.IfBlock.accept(IfBlock.java:82)
...
Attachments
Issue Links
- is part of
-
WW-1722 Select tag breaks when using List with null value
- Closed