Re: TextField and setConvertInputToNull

2009-06-27 Thread Andrea Aime

Andrea Aime ha scritto:
...

Also, the setConvertEmptyInputStringToNull does not mention the
interaction between that and the converters, so arguably there should
be none (or I'm just missing the documentation bits on this topic)


Should I open a issue on Jira and attach a reproducable test case?
Cheers
Andrea

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




TextField and setConvertInputToNull

2009-06-26 Thread Andrea Aime

Hi,
I'm having troubles with null conversion in an application
where we have setup some custom converter locators.

If I understand it properly, a TextField setup like this:

TextField tf = new TextField(id, ...);
tf.setType(String.class);
tf.setConvertEmptyInputStringToNull(true);

that is, without setting an explicit converter, should always
turn the emtpy string to a null, right? Unfortunately it does
not if you have a custom converter locator that does not
let the default CharacterConverter have its way.
However more tests seem to suggest even when one does
not setup a custom converter locator, the default behavior
works by accident: even in the case you don't have a custom converter 
locator, the following, in which the conversion to null is disabled, 
should break:


TextField tf = new TextField(id, ...);
tf.setType(String.class);
tf.setConvertEmptyInputStringToNull(false);

because the default converter is used and that turns
an empty string into nulls even if the setup asks for the opposite
(see CharacterConverter).

Imho it would be better if AbstractTextComponent would override the 
convertInput method and honored the convertEmptyInputStringToNull 
property before trying to use converters. Am I missing something?


Also, the setConvertEmptyInputStringToNull does not mention the
interaction between that and the converters, so arguably there should
be none (or I'm just missing the documentation bits on this topic)

Cheers
Andrea

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org