[ 
https://issues.apache.org/jira/browse/WICKET-231?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jean-Baptiste Quenot reopened WICKET-231:
-----------------------------------------


There is an NPE when getModelObject() returns null, please apply the attached 
patch, and sorry for the inconvenience

> Sanity checks in ListMultipleChoice
> -----------------------------------
>
>                 Key: WICKET-231
>                 URL: https://issues.apache.org/jira/browse/WICKET-231
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>            Reporter: Jean-Baptiste Quenot
>             Fix For: 1.3, 2.0
>
>         Attachments: 20070122-wicket-1.x-ListMultipleChoice
>
>
> 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!

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