Skip to content

StringTextChoiceProvider forcing to override toChoices #24

Closed
tszpinda opened this Issue Oct 3, 2012 · 3 comments

3 participants

@tszpinda
tszpinda commented Oct 3, 2012

If not overridden with something like:

@Override
public Collection<String> toChoices(Collection<String> ids)
{
    return new ArrayList<String>(super.toChoices(ids));
}

will throw exception:

java.lang.UnsupportedOperationException
at java.util.AbstractList.remove(AbstractList.java:161)
at java.util.AbstractList$Itr.remove(AbstractList.java:374)
at java.util.AbstractList.removeRange(AbstractList.java:571)
at java.util.AbstractList.clear(AbstractList.java:234)
at com.vaynberg.wicket.select2.Select2MultiChoice.updateModel(Select2MultiChoice.java:72)

@tgoetz
tgoetz commented Oct 4, 2012

Could this be related to issue #25? Or when exactly do you get this error, do you have some example code?

@tszpinda
tszpinda commented Oct 4, 2012

Problem occurs when I try to remove an item from multi-select menu and its caused by:
Select2MultiChoice.convertInput

and line:

    choices = getProvider().toChoices(Arrays.asList(input.split(",")));

cause Arrays.asList returns read-only list.

@tgoetz
tgoetz commented Dec 13, 2012

I cannot reproduce this (quickstart here: http://cl.ly/363Z330i0l1Q), might have been fixed already by #25.

@ivaynberg ivaynberg closed this Dec 13, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.