Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-2237

DateTimeField throws NPE if date is cleared

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 1.4-RC2
    • 1.4-RC3
    • wicket-datetime
    • None

    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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            para Esko Suomi
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: