Skip to content

Path-binding does not work when conversionService is used and the last path element is of array type [SPR-6501] #11167

Closed
@spring-projects-issues

Description

@spring-projects-issues

Bjarte Andre Eide opened SPR-6501 and commented

When trying to bind an html input field to to a bean, and when the last path element is an array (i.e. myBean.selected[0]), I get the following stack trace:

 
java.lang.IllegalArgumentException: The sourceType to convert to is required
	at org.springframework.util.Assert.notNull(Assert.java:112)
	at org.springframework.core.convert.support.GenericConversionService.assertNotNull(GenericConversionService.java:235)
	at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:118)
	at org.springframework.validation.AbstractPropertyBindingResult.formatFieldValue(AbstractPropertyBindingResult.java:120)
	at org.springframework.validation.AbstractBindingResult.getFieldValue(AbstractBindingResult.java:227)
	at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:120)
	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:175)
	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:195)
	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:161)
	at org.springframework.web.servlet.tags.form.AbstractSingleCheckedElementTag.writeTagContent(AbstractSingleCheckedElementTag.java:84)
	at org.springframework.web.servlet.tags.form.CheckboxTag.writeTagContent(CheckboxTag.java:52)
	at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:91)
	at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:78)

If conversionService is removed, and using properyEditors, the binding works fine.


Affects: 3.0 RC3

Issue Links:

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions