[
https://issues.apache.org/jira/browse/WICKET-2237?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Juergen Donnerstag resolved WICKET-2237.
----------------------------------------
Resolution: Duplicate
Fix Version/s: 1.4-RC3
Looks like it has been fixed in trunk already
public void setDate(Date date)
{
if (date == null) {
this.date = null;
setDefaultModelObject(null);
setHours(null);
setMinutes(null);
return;
}
...
> 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
> Fix For: 1.4-RC3
>
>
> 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 in this. 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.