Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE in SelectedValueComparator with null bound value [SPR-12001] #16617

Closed
spring-projects-issues opened this issue Jul 16, 2014 · 1 comment
Closed
Assignees
Labels
in: web status: backported type: bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Jul 16, 2014

Sebastian Anzani opened SPR-12001 and commented

In case the collection, used to preselect checkboxes values, contains some null values the following exception is thrown:

java.lang.NullPointerException
	org.springframework.web.servlet.tags.form.SelectedValueComparator.exhaustiveCompare(SelectedValueComparator.java:151)
	org.springframework.web.servlet.tags.form.SelectedValueComparator.exhaustiveCollectionCompare(SelectedValueComparator.java:140)
	org.springframework.web.servlet.tags.form.SelectedValueComparator.collectionCompare(SelectedValueComparator.java:112)
	org.springframework.web.servlet.tags.form.SelectedValueComparator.isSelected(SelectedValueComparator.java:89)
	org.springframework.web.servlet.tags.form.AbstractCheckedElementTag.isOptionSelected(AbstractCheckedElementTag.java:61)
	org.springframework.web.servlet.tags.form.AbstractCheckedElementTag.renderFromValue(AbstractCheckedElementTag.java:51)
	org.springframework.web.servlet.tags.form.AbstractCheckedElementTag.renderFromValue(AbstractCheckedElementTag.java:40)
	org.springframework.web.servlet.tags.form.CheckboxTag.writeTagDetails(CheckboxTag.java:90)
	org.springframework.web.servlet.tags.form.AbstractSingleCheckedElementTag.writeTagContent(AbstractSingleCheckedElementTag.java:87)
	org.springframework.web.servlet.tags.form.CheckboxTag.writeTagContent(CheckboxTag.java:53)
	org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:84)
	org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:80)
	org.apache.jsp.page1_jsp._jspx_meth_form_005fcheckbox_005f0(page1_jsp.java:1505)

Affects: 3.2.10, 4.0.5, 4.0.6

Referenced from: commits a3ebf13, 5f77dce, 980f971

Backported to: 3.2.11

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jul 16, 2014

Juergen Hoeller commented

SelectedValueComparator defensively handles null values in exhaustiveCompare now. This will be in the upcoming 4.1 RC1; to be backported to 4.0.7 and 3.2.11 as well.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web status: backported type: bug
Projects
None yet
Development

No branches or pull requests

2 participants