You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sven Meier (JIRA)" <ji...@apache.org> on 2010/12/18 16:10:02 UTC

[jira] Created: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

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


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.


[jira] Commented: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

Posted by "Sven Meier (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12975882#action_12975882 ] 

Sven Meier commented on WICKET-3269:
------------------------------------

> it makes sense that empty strings are converted to nulls, this is what 99% of users expect.
I have to disagree on this generalized statement.

>what if the TextField holds an Integer? we cant push an empty string into the model then, but we can a >null. nulls are more universal then empty strings.

This is a straw man argument: This feature request has no intention to change anything about handling type conversion and/or null conversion of non-String types. It's about removing the special handling of the String type.

>providing an application-wide setting also will not work as it will break component libs that expect empty >strings to be converted to nulls.

Do you have an example case where this would be problematic?

>it is not a job of a converter to perform value->null conversions. converters are there for type conversion, not string manipulation.

Actually they do so already, see AbstractIntegerConverter subclasses as examples.

>this can be toggled application-wide by using IComponentOnBeforeRenderListener to toggle the setting to false

This wouldn't allow to explicitly change the setting for a single component.

IMHO this is the wrong decision. Could we get opinions from other devs on this issue?

Thanks

> 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: AbstractTextComponent_A.diff, AbstractTextComponent_B.diff, 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.


[jira] Updated: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

Posted by "Sven Meier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sven Meier updated WICKET-3269:
-------------------------------

    Attachment:     (was: AbstractTextComponent_B.diff)

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


[jira] Updated: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pedro Santos updated WICKET-3269:
---------------------------------

    Attachment:     (was: WICKET-3269.patch)

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


[jira] Updated: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov updated WICKET-3269:
------------------------------------

    Fix Version/s: 1.5-M4

Set the "Fix version" to 1.5-M4. 
We need to decide whether to change this before starting release candidates.

> 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
>             Fix For: 1.5-M4
>
>         Attachments: AbstractTextComponent_A.diff, AbstractTextComponent_B.diff, 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.


[jira] Commented: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

Posted by "Sven Meier (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12976576#action_12976576 ] 

Sven Meier commented on WICKET-3269:
------------------------------------

I'll gladly continue this discussion on dev@.

But before I do so, I'd like to ask you to take a final look at the attached "emptyStringsToNullConversion.patch" and then reconsider your decision.

The patch doesn't change empty string to null handling, it just moves it into the right location: the converter.

IMHO the change in ConverterLocator (note the adjusted assert in ConvertersTest) proves my point on why this special handling should be removed from AbstractTextComponent and be handled in a more appropriate location. The amount of removed code clearly speaks for itself.

(( Secondary effect:
I can change the conversion in my applications as I like, even if I'm only the 1% usecase ;).
public class Foo {
  public void setBar(String bar) {
    assert bar != null;
    this.bar = bar;
  }
}
If you have this all over the place, you don't want to tell every TextField to leave empty strings empty.
))

> 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: AbstractTextComponent_A.diff, AbstractTextComponent_B.diff, 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.


[jira] Updated: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

Posted by "Sven Meier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sven Meier updated WICKET-3269:
-------------------------------

    Attachment: AbstractTextComponent_A.diff

Proposal A: change default to 'false'.

> 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
>         Attachments: AbstractTextComponent_A.diff, AbstractTextComponent_B.diff
>
>
> 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.


[jira] Updated: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg updated WICKET-3269:
----------------------------------

    Fix Version/s:     (was: 1.5-M4)

> 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: AbstractTextComponent_A.diff, AbstractTextComponent_B.diff, 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.


[jira] Commented: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

Posted by "Sven Meier (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972938#action_12972938 ] 

Sven Meier commented on WICKET-3269:
------------------------------------

Pedro, perhaps I didn't express my intention of this feature request very well:

Personally I'd be happy if the default of convertEmptyInputStringToNull could be changed to 'false' in 1.5.

For Wicket it would be better if we just dropped this whole feature, in spirit of the python's zen: "There should be one-- and preferably only one --obvious way to do it." IMHO this means ""->null conversion should be done in a converter.

> 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
>         Attachments: AbstractTextComponent_A.diff, AbstractTextComponent_B.diff, 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.


[jira] Updated: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

Posted by "Sven Meier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sven Meier updated WICKET-3269:
-------------------------------

    Attachment: emptyStringsToNullConversion.patch

Move empty string to null conversion into converters and remove a lot of code.

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


[jira] Resolved: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-3269.
-----------------------------------

    Resolution: Won't Fix
      Assignee: Igor Vaynberg

i dont think we should change it. it makes sense that empty strings are converted to nulls, this is what 99% of users expect. if i am saving something in the database i would prefer nulls in my columns rather then empty strings for fields that have been left blank by the user.

further, what if the TextField holds an Integer? we cant push an empty string into the model then, but we can a null. nulls are more universal then empty strings.

providing an application-wide setting also will not work as it will break component libs that expect empty strings to be converted to nulls.

also, it is not a job of a converter to perform value->null conversions. converters are there for type conversion, not string manipulation.

this can be toggled application-wide by using IComponentOnBeforeRenderListener to toggle the setting to false, although i would not recommend doing so.

> 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
>             Fix For: 1.5-M4
>
>         Attachments: AbstractTextComponent_A.diff, AbstractTextComponent_B.diff, 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.


[jira] Commented: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12973033#action_12973033 ] 

Juergen Donnerstag commented on WICKET-3269:
--------------------------------------------

I tend to agree with Sven. If needed users can create their own Converter

> 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
>         Attachments: AbstractTextComponent_A.diff, AbstractTextComponent_B.diff, 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.


[jira] Commented: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972860#action_12972860 ] 

Pedro Santos commented on WICKET-3269:
--------------------------------------

Hi Sven, try to use ComponentInitializationListenerCollection instead of ComponentInstantiationListenerCollection.
I think AbstractTextComponent should override convertInput method in order to use an appropriate IConverter setting null for empty strings. This way we maintain the API and users don't need to care about the form component type set or not.
This way the setConvertEmptyInputStringToNull javadoc needs to have a good explanation saying that this property will be respected only if the user do not override the converInput method.

> 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
>         Attachments: AbstractTextComponent_A.diff, AbstractTextComponent_B.diff, WICKET-3269-test.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.


[jira] Issue Comment Edited: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972860#action_12972860 ] 

Pedro Santos edited comment on WICKET-3269 at 12/18/10 2:55 PM:
----------------------------------------------------------------

Hi Sven, try to use ComponentInitializationListenerCollection instead of ComponentInstantiationListenerCollection.
I think AbstractTextComponent should implement convertInput method setting null for empty strings. This way we maintain the API and users don't need to care about the form component type set or not.
This way the setConvertEmptyInputStringToNull javadoc needs to have a good explanation saying that this property will be respected only if the user do not override the converInput method.

      was (Author: pedrosans):
    Hi Sven, try to use ComponentInitializationListenerCollection instead of ComponentInstantiationListenerCollection.
I think AbstractTextComponent should override convertInput method in order to use an appropriate IConverter setting null for empty strings. This way we maintain the API and users don't need to care about the form component type set or not.
This way the setConvertEmptyInputStringToNull javadoc needs to have a good explanation saying that this property will be respected only if the user do not override the converInput method.
  
> 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
>         Attachments: AbstractTextComponent_A.diff, AbstractTextComponent_B.diff, WICKET-3269-test.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.


[jira] Updated: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pedro Santos updated WICKET-3269:
---------------------------------

    Attachment: WICKET-3269-test.patch

Test case exposing the problem.

> 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
>         Attachments: AbstractTextComponent_A.diff, AbstractTextComponent_B.diff, WICKET-3269-test.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.


[jira] Commented: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Commented: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

Posted by "Sven Meier (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12976877#action_12976877 ] 

Sven Meier commented on WICKET-3269:
------------------------------------

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

Yes, this is why I'm proposing the change for 1.5 (not 1.4).
Note that AbstractTextComponent has convertEmptyStringsToNull set to true by default anyway, so this change should not effect too much people.

Take a look at all other asserts in this test, they all expect null (except the boolean case). If I may quote Igor: "so why should wicket treat strings differently then other types?"

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


[jira] Updated: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pedro Santos updated WICKET-3269:
---------------------------------

    Attachment:     (was: WICKET-3269-test.patch)

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


[jira] Updated: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

Posted by "Sven Meier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sven Meier updated WICKET-3269:
-------------------------------

    Attachment: AbstractTextComponent_B.diff

Proposal B: Drop convertEmptyInputStringToNull.

> 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
>         Attachments: AbstractTextComponent_A.diff, AbstractTextComponent_B.diff
>
>
> 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.


[jira] Updated: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pedro Santos updated WICKET-3269:
---------------------------------

    Attachment: WICKET-3269.patch

Patch changing AbstractTextComponent to test the convertEmptyInputStringToNull in the convertInput method

> 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
>         Attachments: AbstractTextComponent_A.diff, AbstractTextComponent_B.diff, 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.


[jira] Updated: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

Posted by "Sven Meier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sven Meier updated WICKET-3269:
-------------------------------

    Attachment:     (was: AbstractTextComponent_A.diff)

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


[jira] Commented: (WICKET-3269) Review AbstractTextComponent's handling of empty Strings in 1.5

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12975894#action_12975894 ] 

Igor Vaynberg commented on WICKET-3269:
---------------------------------------

>> it makes sense that empty strings are converted to nulls, this is what 99% of users expect. 
>I have to disagree on this generalized statement. 

you are free to disagree, but the fact remains that this is the first time it has come up in many years to my knowledge.

>>what if the TextField holds an Integer? we cant push an empty string into the model then, but we can a >null. nulls are
>>more universal then empty strings. 
>This is a straw man argument: This feature request has no intention to change anything about handling type conversion 
>and/or null conversion of non-String types. It's about removing the special handling of the String type. 

so why should wicket treat strings differently then other types? if we convert an empty integer field to a null why shouldnt we a string? didnt you make the argument that things should work consistently?

>>providing an application-wide setting also will not work as it will break component
>> libs that expect empty >strings to be converted to nulls. 
>Do you have an example case where this would be problematic? 

i write a component library that has a component that depends on the empty string converted to null, you throw it into your app where the default is not to, my component now breaks

conversely, i write a component that assumes the setting is to convert to empty strings, you drop it into the app where its not, results in an NPE

>>it is not a job of a converter to perform value->null conversions. converters are there for type conversion, 
>>not string manipulation. 
>Actually they do so already, see AbstractIntegerConverter subclasses as examples. 

that code is there to protect against an edgecase when a locale can convert a nonempty string value into null

>>this can be toggled application-wide by using IComponentOnBeforeRenderListener to toggle the setting to false 
>This wouldn't allow to explicitly change the setting for a single component. 

of course it would, tag the components you want left alone with a piece of metadata and make the listener check for it

i would actually like to hear the usecase for why you would want empty strings rather then nulls other then "its a requirement in our application".

if you want more feedback you have more chances if you move this thread to dev@

> 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: AbstractTextComponent_A.diff, AbstractTextComponent_B.diff, 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.