[ 
http://issues.apache.org/struts/browse/WW-1567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_39237
 ] 

Don Brown commented on WW-1567:
-------------------------------

Makes sense to me.  I'll apply it in a few days if there are no objections.


> Poor error reporting in the select freemarker template
> ------------------------------------------------------
>
>                 Key: WW-1567
>                 URL: http://issues.apache.org/struts/browse/WW-1567
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Views
>    Affects Versions: 2.0.2
>            Reporter: Tom Schneider
>            Priority: Minor
>             Fix For: 2.0.3
>
>
> 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)
>       ...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to