moremore0812 / cqengine

Automatically exported from code.google.com/p/cqengine
0 stars 0 forks source link

ObjectLockingIndexedCollection's StripedLock does not handle negative hashcodes #35

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a class that overrides hashCode method and produces a negative hash 
code.

2. Create an indexed collection of the class created in step 1 that is backed 
by an ObjectLockingIndexedCollection.

3. Attempt to add an instance of the test class to the collection.

What is the expected output? What do you see instead?
Expected: object added to collection.
Instead: ArrayIndexOutOfBoundsException

What version of the product are you using? On what operating system?
1.2.6, Windows 7 Enterprise

Please provide any additional information below.
The StripedLock class needs to account for negative hash code values to avoid 
indexing into the array of locks with a negative index value.

Original issue reported on code.google.com by mbje...@gmail.com on 7 Apr 2014 at 9:59

GoogleCodeExporter commented 9 years ago
Thanks for reporting this.

It's now fixed, and the fix is in CQEngine 1.2.7. It should sync to Maven 
central in the next few hours.

Original comment by ni...@npgall.com on 7 Apr 2014 at 10:23