[
https://issues.apache.org/jira/browse/WW-4168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13734026#comment-13734026
]
Bruce Phillips edited comment on WW-4168 at 8/8/13 9:33 PM:
------------------------------------------------------------
Greg - I'm not following your example code above. The name attribute's value
will be evaluated as a String not as an OGNL expression the way you have
written it. So I don't follow how the name attribute's value can be null.
As I mentioned before there is a form tags example that includes using the
checkBoxList Struts tag here:
https://svn.apache.org/repos/asf/struts/sandbox/trunk/struts2examples
You can checkout the examples. Feel free to modify the form tags example to
generate the NPE and then attach your zipped form tags example to this issue.
Also I'm not sure that the framework should handle/check for NPE when the NULL
value is a result of a framework user's code.
Bruce
was (Author: bphillips):
Greg - I'm not following your example code above. The name attribute's
value will be evaluated as a String not as an OGNL expression that way you have
written it. So I don't follow how the name attribute's value can be null.
As I mentioned before there is a form tags example that includes using the
checkBoxList Struts tag here:
https://svn.apache.org/repos/asf/struts/sandbox/trunk/struts2examples
You can check the examples. Feel free to modify the form tags example to
generate the NPE and then attach your zipped form tags example to this issue.
Also I'm not sure that the framework should handle/check for NPE when the NULL
value is a result of a framework user's code.
Bruce
> NullPointerException on Checkboxlist
> -------------------------------------
>
> Key: WW-4168
> URL: https://issues.apache.org/jira/browse/WW-4168
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - Java Templates
> Affects Versions: 2.3.15.1
> Environment: tomcat/centos 5
> Reporter: Greg Huber
> Assignee: Bruce Phillips
> Priority: Minor
> Fix For: 2.3.16
>
>
> Hello,
> I am getting null pointer exceptions on line :
> Caused by: java.lang.NullPointerException
> at template.events.CheckboxListHandler.isChecked(CheckboxListHandler.java:125)
> at template.events.CheckboxListHandler.generate(CheckboxListHandler.java:80)
> at org.apache.struts2.views.java.DefaultTheme.renderTag(DefaultTheme.java:120)
> at
> org.apache.struts2.views.java.JavaTemplateEngine.renderTemplate(JavaTemplateEngine.java:95)
> at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:572)
> at org.apache.struts2.components.UIBean.end(UIBean.java:526)
> we need to check for if(nameValues)!=null
> ie:
> {code:java}
> private Boolean isChecked(Map<String, Object> params, String itemKeyStr) {
> Boolean checked = false;
> if (itemKeyStr != null) {
> String[] nameValues = (String[]) params.get("nameValue");
> if(nameValues)!=null // need this <<<<<<<<<<
> for (String value : nameValues) {
> if (checked = value.equalsIgnoreCase(itemKeyStr))
> { break; }
> }
> }
> }
> return checked;
> }
> {code}
> Cheers Greg
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira