Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
awaiting-response
-
All platforms
Description
Hello, guys! I noticed a small bug in InterProcessReadWriteLock#readLockPredicate() method:
InterProcessReadWriteLock.java, lines 196-211
int ourIndex = Integer.MAX_VALUE; for ( String node : children ) { if ( node.contains(WRITE_LOCK_NAME) ) { firstWriteIndex = Math.min(index, firstWriteIndex); } else if ( node.startsWith(sequenceNodeName) ) { ourIndex = index; break; } ++index; } StandardLockInternalsDriver.validateOurIndex(sequenceNodeName, ourIndex);
In case if sequenceNodeName is not in children list, StandardLockInternalsDriver.validateOurIndex() won't throw exception, because ourIndex in this case equals to Integer.MAX_VALUE.
I'm creating pull request on Github to fix this issue.
I know it's a very rare case, but why not fix it anyways?
Attachments
Issue Links
- is duplicated by
-
CURATOR-307 InterProcessReadWriteLock can throw IndexOutOfBoundsException when connection is lost
- Closed