Wicket
  1. Wicket
  2. WICKET-5437

When a ConversionException is thrown, its message is not used in the ValidationError

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 6.11.0
    • Fix Version/s: 6.13.0, 7.0.0-M1
    • Component/s: wicket
    • Labels:
      None

      Description

      Probably affects 6.12 also, though haven't checked.

      As noted by Martin Grigorov in ISIS-621:

      The code for creating a ValidationError is at
      https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java?source=c#L1219

      As you can see the cause's message is not used :-/

      The problem is:
      ValidationError error = new ValidationError();

      it should be:
      ValidationError error = new ValidationError(cause.getMessage());

      Later at https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/validation/ValidationError.java?source=c#L241 Wicket will look for i18n keys and fallback to the message.

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        51m 41s 1 Martin Grigorov 05/Dec/13 16:33
        Martin Grigorov made changes -
        Field Original Value New Value
        Resolution Fixed [ 1 ]
        Fix Version/s 7.0.0 [ 12322958 ]
        Fix Version/s 6.13.0 [ 12325564 ]
        Assignee Martin Grigorov [ mgrigorov ]
        Status Open [ 1 ] Resolved [ 5 ]
        Hide
        Martin Grigorov added a comment -

        I've committed my suggestion.
        Now if there are no i18n keys that match Wicket will use the message.

        But I think in your case there is some generic key that matches, no ?

        Show
        Martin Grigorov added a comment - I've committed my suggestion. Now if there are no i18n keys that match Wicket will use the message. But I think in your case there is some generic key that matches, no ?
        Hide
        Martin Grigorov added a comment -

        As I explained the message will be used as a fallback.
        The recommended way is to use i18n resource bundle.

        Show
        Martin Grigorov added a comment - As I explained the message will be used as a fallback. The recommended way is to use i18n resource bundle.
        Dan Haywood created issue -

          People

          • Assignee:
            Martin Grigorov
            Reporter:
            Dan Haywood
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development