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

Sanity checks in ListMultipleChoice

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      When saving a form containing a ListMultipleChoice, updateModel() method is called, and the Collection returned as model object is modified in-place to remove the old values and add the newly selected values.

      This behaviour breaks the principle of least surprise, as a user may not be aware of those implementation details. Therefore I propose to add a sanity check in updateModel() to verify that getModelObject() always returns the same Collection instance. Otherwise, an exception is thrown explaining the problem, to instruct the user to change the client code accordingly. The current silent behaviour is very disappointing for someone not knowing the internals of ListMultipleChoice, and it's likely that the user gets lost in hours of debugging.

      See patch attached. Thanks!

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            jbq Jean-Baptiste Quenot
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment