Opened 14 years ago

Closed 14 years ago

#473 closed defect (duplicate)

serious but easy-to-fix bug in Collections.js

Reported by: aduston@… Owned by: anonymous
Priority: high Milestone:
Component: Core Version: 0.2
Keywords: Cc:
Blocked By: Blocking:

Description

try to use the addRange method of ArrayList?, passing a 1-element ArrayList? as an argument. You'll see that it fails. Also, try to clone a 1-element SortedList? or Dictionary. Again, it will fail. I believe that the problem is the atEnd property of dojo.collections.Iterator and dojo.collections.DictionaryIterator?; change these to position>=obj.length instead of position>=obj.length-1.

Attachments (1)

Collections.js.patch (666 bytes) - added by anonymous2 14 years ago.
Fix atEnd value.

Download all attachments as: .zip

Change History (3)

Changed 14 years ago by anonymous2

Attachment: Collections.js.patch added

Fix atEnd value.

comment:1 Changed 14 years ago by anonymous2

I confirm the problem : Iterator doesn't work when the list has only one element. I think the correct fix is to use > instead >= when creating the iterator. (obj.length-1 is correct since the first element index is 0).

I've attached a patch to fix the problem in Collections.js.

comment:2 Changed 14 years ago by Tom Trenka

Resolution: duplicate
Status: newclosed

This is a duplicate to bug #408; closing in favor of that.

Note: See TracTickets for help on using tickets.