java.lang.ArrayIndexOutOfBoundsException when indexing a doc, closes #1094.

This commit is contained in:
kimchy 2011-07-06 18:57:11 +03:00
parent c9d619ea4f
commit 6f7b462f1d
1 changed files with 6 additions and 1 deletions

View File

@ -1182,7 +1182,12 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
}
private Object dirtyLock(String id) {
return dirtyLocks[Math.abs(id.hashCode()) % dirtyLocks.length];
int hash = id.hashCode();
// abs returns Integer.MIN_VALUE, so we need to protect against it...
if (hash == Integer.MIN_VALUE) {
hash = 0;
}
return dirtyLocks[Math.abs(hash) % dirtyLocks.length];
}
private Object dirtyLock(Term uid) {