CompositeErrorMessage unable to merge InvalidValueException and UserError

Hi,

I have a problem of duplicate validation error messages at Form level.

In class com.vaadin.server.CompositeErrorMessage , the constructor:
“public CompositeErrorMessage(ErrorMessage… errorMessages)” is designed to remove duplicate error messages ( see comment “Duplicate errors are ignored.” of method addErrorMessage).

Duplicates are not removed if a CompositeErrorMessage is built with 2 ErrorMessage with the same text but 2 different types: one InvalidValueException and one UserError.

Inedeed the text of the UserError is not modified when its value is retrieved, but the text of the InvalidValueException is converted to safe html in method getErrorMessage() of com.vaadin.ui.AbstractField with the call to AbstractErrorMessage.getErrorMessageForException.

This leads to the build of a CompositeErrorMessage with twice the same error (one labelunchanged and one converted to safe html). See attached.

And this leads to the same error message beeing displayed twice at the bottom of the form.

Do you have any workaround / hint to avoid this behaviour?

thanks

Matthieu

13411.jpg