Issue Details (XML | Word | Printable)

Key: NUCCORE-511
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Peter Dettman
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Core

SCOListIterator add/remove/set behaviour incorrect

Created: 16/Apr/10 05:30 PM   Updated: 04/Oct/12 05:02 PM   Resolved: 16/Apr/10 06:47 PM
Component/s: Persistence
Affects Version/s: 2.1.0.m1
Fix Version/s: 2.0.4, 2.1.0.m2

File Attachments: 1. Text File NUCCORE-511-core.patch (6 kB)


Datastore: PostgreSQL


 Description  « Hide
The javadocs for java.util.ListIterator explain:
"Note that the remove() and set(Object) methods are not defined in terms of the cursor position; they are defined to operate on the last element returned by a call to next() or previous()."

I am attaching a patch (against HEAD) including
1. A new test case in SCOListIteratorTest that focuses on add/remove/set in various combinations.
2. A re-implementation of several methods of SCOListIterator to pass this new test and the existing ones.

In the new version, the class relies on it's internal ListIterator ('iter') to enforce all the usage restrictions; all calls are forwarded to 'iter' before any side-effects are applied to the fields, or the SCO (to avoid exceptions leaving it in an unexpected state). Several methods rely on 'iter' to determine the relevant index for a call to the SCO.


Peter Dettman added a comment - 16/Apr/10 05:32 PM
Extra test case in SCOListIteratorTest and fixes to SCOListIterator

Peter Dettman made changes - 16/Apr/10 05:32 PM
Field Original Value New Value
Attachment NUCCORE-511-core.patch [ 11130 ]
Andy Jefferson added a comment - 16/Apr/10 06:47 PM
Patch applied to SVN trunk, and adapted to branches/2.0. Thx

Andy Jefferson made changes - 16/Apr/10 06:47 PM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 2.0.4 [ 10921 ]
Fix Version/s 2.1.0.m2 [ 10901 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 26/Apr/10 03:37 PM
Status Resolved [ 5 ] Closed [ 6 ]
Andy Jefferson made changes - 04/Oct/12 05:02 PM
Component/s Persistence [ 10200 ]
Component/s JDO [ 10201 ]