Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-3269

Review AbstractTextComponent's handling of empty Strings in 1.5

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • 1.5-M3
    • None
    • wicket
    • None

    Description

      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.

      Attachments

        Activity

          People

            ivaynberg Igor Vaynberg
            svenmeier Sven Meier
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: