[ 
https://issues.apache.org/jira/browse/WICKET-606?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12500470
 ] 

Johan Compagner commented on WICKET-606:
----------------------------------------

that is not that simple because if you have a type then the type converter is 
in control how to handle nulls and empty strings
for example if the type is a Number then an empty string will always return 
null (no matter what it is)

os if you are saying false in convert empty string to null and the type is not 
String then something really goes wrong.

So the only use of the getConvertEmptyInput is if the type is a String, so the 
question is how are we going to give that behavior
to the StringConverter??

the only thing i can think of is that AbstractTextComponent does override:

        public IConverter getConverter(Class/* <?> */type)
        {
                return getSession().getConverter(type);
        }


and if the type is String return a wrapper around the converter
that is given by the session. And handle the value based on the conver empty 
input setting.

any other ideas?

> AbstractTextComponent#setConvertEmptyInputStringToNull(true) does not work 
> with IObjectClassAwareModels (affects TextField, etc.)
> ---------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-606
>                 URL: https://issues.apache.org/jira/browse/WICKET-606
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: trunk
>            Reporter: Alastair Maw
>            Priority: Blocker
>             Fix For: 1.3.0-beta2
>
>
> The unit tests ought to cover this, but apparently don't. A TextField should 
> convert empty strings to nulls if you call 
> setConvertEmptyInputStringToNull(true) on it (which the constructors do by 
> default).
> However, this doesn't currently work:
>  - AbstractTextComponent#getConvertEmptyInputStringToNull() is only called 
> from AbstractTextComponent#convertValue(String[]).
>  - AbstractTextComponent#convertValue(String[]) is called from 
> FormComponent#convert(), but only if the component doesn't have a type 
> assigned to it.
>  - As soon as you use a PropertyModel (which implements 
> IObjectClassAwareModel), this means empty strings are no longer converted to 
> nulls.
> This is obviously a great big blocker and needs fixing ASAP.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to