You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Esko Suomi (JIRA)" <ji...@apache.org> on 2009/04/23 12:06:47 UTC

[jira] Updated: (WICKET-2237) DateTimeField throws NPE if date is cleared

     [ https://issues.apache.org/jira/browse/WICKET-2237?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Esko Suomi updated WICKET-2237:
-------------------------------

    Description: 
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.

  was:
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.


> 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 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.