Skip to content

Option to expose empty value instead of NullValueInNestedPathException [SPR-1671] #6368

@spring-projects-issues

Description

@spring-projects-issues

Rob Monie opened SPR-1671 and commented

When using nested paths such as "organisation.address.state" with a property editor for State intended to convert a String ID to a State object and back again, if address is null, a 'NullValueInNestedPathException' is thrown from BeanWrapperImpl. Is this the intended behaviour ?

Obviously if part of the nested path is null it is impossible to traverse the object graph to determine what property editor to use for the actual State property. However, if address is null then State is sure to be null also, so a generic handler of nulls could be possibly be applied.

The current workaround is to manually populate empty objects in the object graph in formBackingObject(). This does however require that these 'empty' placeholder objects need to be cleaned up before a save to prevent complications with incorrect data being pushed to the database.


Affects: 1.2.6

Issue Links:

38 votes, 37 watchers

Metadata

Metadata

Assignees

Labels

has: votes-jiraIssues migrated from JIRA with more than 10 votes at the time of importin: webIssues in web modules (web, webmvc, webflux, websocket)status: duplicateA duplicate of another issuetype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions