Issue Details (XML | Word | Printable)

Key: GRAILS-4485
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Graeme Rocher
Reporter: Robert Fletcher
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Grails

Binding errors are not reported on nullable properties

Created: 27/Apr/09 11:05 AM   Updated: 11/May/09 02:34 PM   Resolved: 11/May/09 09:31 AM
Return to search
Component/s: Controllers
Affects Version/s: 1.1
Fix Version/s: 1.1.1

Time Tracking:
Not Specified

File Attachments: 1. GZip Archive dateBindingError.tar.gz (153 kB)


Testcase included: yes


 Description  « Hide

When binding to a domain object with a nullable property, typeMismatch errors are ignored - the property simply remains unchanged. Example is attached with a simple failing test. Removing the nullable: true from the dateOfBirth property in the domain class causes the test to pass as the binding error is detected.



Graeme Rocher added a comment - 11/May/09 04:02 AM

We need to be careful with this issue, because if I recall there was another issue that asked for nullable:true to bind to null if the input was invalid. However, i think that makes sense of target type is a String and the input is a blank String like "" in which case you expect a result of null. Also if it was an Integer you would expect null to for a blank string.

So the point is the handling of blank needs to be treated differently to the handling of actual user input


Graeme Rocher added a comment - 11/May/09 04:21 AM

See GRAILS-1383 which is the issue that probably caused the regression here


Graeme Rocher added a comment - 11/May/09 09:18 AM

Actually this issue caused the regression GRAILS-1793 which describes how an empty date field can't be persisted


Peter Martin added a comment - 11/May/09 02:34 PM

I just noticed this issue also I was going to post it as an issue when I saw this.