Spring Roo
  1. Spring Roo
  2. ROO-190

Date fields does not allow null values

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.0.RC1
    • Fix Version/s: 1.0.0.RC2
    • Component/s: None
    • Labels:
      None

      Description

      1. Create new pojo with jdk or jpa date field - no validations at all
      2. mvn tomcat:run
      3. try to save empty form

      Failed to convert property value of type [java.lang.String] to required type [java.util.Date] for property someDate; nested exception is java.lang.IllegalArgumentException: Could not parse date: Unparseable date: ""
      

      Hmm...

        Activity

        Hide
        Stefan Schmidt added a comment -

        Tomasz,

        I have adjusted the controller code to allow empty date field submissions in CustomDateEditor.

        binder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));

        This should do the trick.

        -Stefan

        Show
        Stefan Schmidt added a comment - Tomasz, I have adjusted the controller code to allow empty date field submissions in CustomDateEditor. binder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true)); This should do the trick. -Stefan

          People

          • Assignee:
            Stefan Schmidt
            Reporter:
            Tomasz Wysocki
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: