Oh no .. this is even more sinister than normal synchronization... And actually, I think ArrayList may not suffer from this problem I ran into, but I am forced to use Vector to maintain 1.1 compatibility.
Basically, make a call to .elements() and start going through the Enumeration. While enumerating the elements, modify the Vector. It silently works and just screws the Enumeration all up (i.e. off-by-one's, etc). I _think_ that ArrayList (and the new collections) throw a ConcurrentModificationException.... But not our old retarded friend Vector.
The actual deal was that while enumerating dirty nodes during synchronization, I clean up after synching each node. Well, the cleanup for an FIDDeleted is to actually complete the deletion and remove it from memory. This was pretty indirect, but what it meant was that ultimately I was changing the Vector of nodes that I was in the middle of enumerating. I changed the implementation instead to just mark it setDirty(false) and just leave it in memory. If the sync succeeds, it will just reload the database anyway, so this code is really only there to handle cancelling in the middle of a sync.
Bleaugh.
ms