[JIRA] Created: (JXT-82) ListView's clear empties the whole backingList instead of only the entries it's responsible for

anli.shundi@idp.protectnetwork.org (JIRA) noreply at shibboleth.net
Fri Oct 21 06:10:25 BST 2011


ListView's clear empties the whole backingList instead of only the entries it's responsible for
-----------------------------------------------------------------------------------------------

                 Key: JXT-82
                 URL: https://issues.shibboleth.net/jira/browse/JXT-82
             Project: XMLTooling - Java
          Issue Type: Bug
    Affects Versions: 1.3.1
            Reporter: anli.shundi at idp.protectnetwork.org
            Assignee: Chad La Joie


class {{ListView<ElementType extends XMLObject> extends AbstractList<ElementType>}} inside {{IndexedXMLObjectChildrenList}} overrides the method {{clear()}} of {{java.util.AbstracList}} but violates its javadoc:

According to http://download.oracle.com/javase/6/docs/api/java/util/AbstractList.html#subList(int,%20int)
{quote}
...the following idiom removes a range of elements from a list:

      {{list.subList(from, to).clear();}}
{quote}

ListView's clear calls {{backingList.clear();}} instead; that is it clears the whole backing list instead of limiting to the QNames it lists itself.  A quick fix would be to call {{backingList.removeAll(this)}} instead.



--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the commits mailing list