DateTimeField throws NPE if date is cleared
-------------------------------------------
Key: WICKET-2237
URL: https://issues.apache.org/jira/browse/WICKET-2237
Project: Wicket
Issue Type: Bug
Components: wicket-datetime
Affects Versions: 1.4-RC2
Reporter: Esko Suomi
We use DateTimeField to set a date of bean object and want to allow user to
null that field by removing the date. Separate checkbox/button for setting the
date to null would be unintuitive). However when the user does that, NPE is
thrown at DateTimeField#setTime(Date date):239, because if the parameter date
is null (as in this case it is), the flow of the method is as follows:
231: set this.date to null
232: set default model object to null
239: call .set() on this.date which is now null - throws NPE
Most simple fix for this would most likely be to insert if(date == null) {
return; } to line 233.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.