diff --git a/src/java/org/apache/lucene/analysis/CharArraySet.java b/src/java/org/apache/lucene/analysis/CharArraySet.java index 2bef4b82140..635f8f8a221 100644 --- a/src/java/org/apache/lucene/analysis/CharArraySet.java +++ b/src/java/org/apache/lucene/analysis/CharArraySet.java @@ -191,22 +191,15 @@ public class CharArraySet extends AbstractSet { } private int getHashCode(CharSequence text) { - int code; + int code = 0; + int len = text.length(); if (ignoreCase) { - code = 0; - int len = text.length(); for (int i=0; i for this set. Strings are constructed on the fly, so diff --git a/src/test/org/apache/lucene/analysis/TestCharArraySet.java b/src/test/org/apache/lucene/analysis/TestCharArraySet.java index 7a17bf5c028..84f37fcf1ea 100755 --- a/src/test/org/apache/lucene/analysis/TestCharArraySet.java +++ b/src/test/org/apache/lucene/analysis/TestCharArraySet.java @@ -21,8 +21,8 @@ import java.util.Arrays; import org.apache.lucene.util.LuceneTestCase; -public class TestCharArraySet extends LuceneTestCase -{ +public class TestCharArraySet extends LuceneTestCase { + public void testRehash() throws Exception { CharArraySet cas = new CharArraySet(0, true); for(int i=0;i