OldTruckDriver opened a new pull request, #688:
URL: https://github.com/apache/commons-collections/pull/688

   [COLLECTIONS-892] Fix unique IndexedCollection add atomicity
   
   IndexedCollection#add(Object) updated the decorated collection before 
checking the unique index constraint. If a duplicate transformed key was 
rejected, the exception was thrown after the decorated collection had already 
been mutated, leaving the collection and index out of sync.
   
   This change checks duplicate keys before mutating the decorated collection 
for unique indexed collections. Non-unique indexed collections keep the 
existing add path.
   
   Tests cover a failed unique add where "01" and "1" map to the same key, and 
verify that the decorated collection and index still contain only the original 
value.
   
   Tests run:
   - mvn -q 
-Dtest=org.apache.commons.collections4.collection.IndexedCollectionTest#testFailedUniqueAddDoesNotPolluteDecoratedCollection
 test
   - mvn -q 
-Dtest=org.apache.commons.collections4.collection.IndexedCollectionTest test
   - mvn -q
   - git diff --check


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to