[ 
https://issues.apache.org/jira/browse/WICKET-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12976659#action_12976659
 ] 

Martin Grigorov commented on WICKET-3269:
-----------------------------------------

>From the latest patch:

--- 
wicket-core/src/test/java/org/apache/wicket/util/convert/converters/ConvertersTest.java
     (revision 1054484)
+++ 
wicket-core/src/test/java/org/apache/wicket/util/convert/converters/ConvertersTest.java
     (working copy)
@@ -95,7 +95,7 @@
                
assertNull(converter.getConverter(Double.class).convertToObject("", Locale.US));
                assertEquals(Boolean.FALSE, 
converter.getConverter(Boolean.class).convertToObject("",
                        Locale.US));
-               
assertNotNull(converter.getConverter(String.class).convertToObject("", 
Locale.US));
+               
assertNull(converter.getConverter(String.class).convertToObject("", Locale.US));

This one looks really strange. 
"" is converted to null. This may break some existing apps out there.

> Review AbstractTextComponent's handling of empty Strings in 1.5
> ---------------------------------------------------------------
>
>                 Key: WICKET-3269
>                 URL: https://issues.apache.org/jira/browse/WICKET-3269
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.5-M3
>            Reporter: Sven Meier
>            Assignee: Igor Vaynberg
>         Attachments: emptyStringsToNullConversion.patch, 
> WICKET-3269-test.patch, WICKET-3269.patch
>
>
> Context:
> With convertEmptyInputStringToNull set to 'true' (the default), 
> AbstractTextComponent converts empty strings to 'null'.
> This works only if the component doesn't know its model type.
> Problem:
> In our application we would like to always keep empty Strings as they are. We 
> tried to use a ComponentInstantiationListener to set 
> convertEmptyInputStringToNull to 'false', but regretfully 
> AbstractTextComponent reverts this setting to 'true' in its constructor.
> Proposals for 1.5 (either A or B):
> A) Change default of convertEmptyInputStringToNull to 'false'.
> - allows applications to keep empty strings as they are,
> - if needed, clients can use a ComponentInstantiationListener to globally set 
> convertEmptyInputStringToNull to 'true' for the old default
> B) Remove support for special handling of empty strings.
> - no special handling in #convertValue(String[]) and #resolveType() needed,
> - no more ambiguity whether ConvertEmptyInputStringToNull has any effect 
> (model type known or not),
> - if needed, clients can use a custom Converter to convert empty strings to 
> 'null'.
> See attached patches, note that no unit tests changes were required.
> Thanks for your consideration.

-- 
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