Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-26792

ArrayCollection.addAll with a filter function raise a "out of bounds" RangeError

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Adobe Flex SDK 4.1 (Release)
    • None
    • Collections
    • None
    • Affected OS(s): Mac
      Affected OS(s): Mac OS 10.5
      Language Found: English

    Description

      Steps to reproduce:
      1. create an ArrayCollection
      2. apply a filterfunction
      3. add elements to this collection with the addAll function (at least one of the element has to be hidden by the filterfunction)

      var list:ArrayCollection = new ArrayCollection();
      list.filterFunction = filter;
      list.refresh();
      var items:ArrayList = new ArrayList([1,2,3,4,5]);
      list.addAll(items);

      public function filter(obj:Object) : Boolean {
      var n:Number = obj as Number;
      return n<2;
      }

      Actual Results:
      the addAll function raise an RangeError error

      Expected Results:
      the items should be added an the filter function should be applied correctly

      Workaround (if any):
      By debugging the SDK, i've that the bug occurs in addAllAt, the workaround is to create a class which extends ArrayCollection and overrides addAllAt this way :

      public function addAllAt(addList:IList, index:int):void
      {
      var at:int = i+index;
      if(at>length)

      { at=length; }

      addItemAt(addList.getItemAt, at);
      }

      Attachments

        Activity

          People

            adobejira Adobe JIRA
            adobejira Adobe JIRA
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: