Hi devs,

There is something that looks strange to me.

When you want to raise a validation error like:

            ValidationError error = new ValidationError();
            error.addKey("MyComponent.ConversionError");
            error.setVariable("myvar", myvalue);

            this.error(error);

A call is made to FormComponent.MessageSource.substitute which returns
new VariableInterpolator(...).toString()

The second arg to VariableInterpolator is meant for
"exceptionOnNullVarValue" but what is supplied in #substitute() is
Application.get().getResourceSettings().getThrowExceptionOnMissingResource().

That's where it looks strange because #getThrowExceptionOnMissingResource()
represents a flag about missing resources (like MyComponent.properties) and
as nothing related to null values in my understanding.

In addition to this, I think there is a bug: if
#getThrowExceptionOnMissingResource() return *false* and myvalue is *null*,
the validation error message gives something of the form "value of myvar:
${myvar}" instead of "value of myvar: null".

(tested upon wicket 6.18.0 & 7.0.0-SNAPSHOT)

Quickstart? Ticket? Coffee?

Thanks & best regards,
Sebastien.

Reply via email to