Announcement Announcement Module
Collapse
No announcement yet.
Suppress Date Error (Annotation) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Suppress Date Error (Annotation)

    Hi,

    i use the initBinder to check a date.
    i also use a @NotNull annotation for this date.

    The problem is that i get 2 errors when i have a wrong date.
    1. Init Binder Error
    2. Date is NotNull

    Is there a possibility to suppress the annotation error, when the initbinder throws an error ?

  • #2
    What error does the initBinder throw?

    Comment


    • #3
      typeMismatch.java.util.Date

      Comment


      • #4
        I think it's typeMismatch.fieldName

        Comment


        • #5
          I define a initBinder like that:

          SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy", Locale.GERMAN);
          df.setLenient(false);
          CustomDateEditor editor = new CustomDateEditor(df, true, ZEHN);
          binder.registerCustomEditor(Date.class, editor);

          --> When the User enter a wrong date like : 32534
          i get :

          typeMismatch.java.util.Date exception
          AND
          I get my notnull exception
          @NotNull(message = "blabla")
          private Date datefield;

          Comment


          • #6
            If you have a error resource bundle configured just put a new entry in it with the key typeMismatch.fieldName. Whenever there is an exception while parsing the data, the error will show up instead of an exception.

            Comment


            • #7
              this is clear. The Problem that i want to suppress the @NotNull Annotation when i have a typeMismatch.fieldName exception.

              Comment

              Working...
              X