Skip to content

Apache Lucene open-source search software

fix test fail

Robert Muir7ddbf59fbd1d
diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java
index 88c668f4dd9..2ee380e3478 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java
@@ -1475,7 +1475,9 @@ public abstract class BasePostingsFormatTestCase extends LuceneTestCase {
}
// Also test seeking the TermsEnum:
- for(String term : termFreqs.keySet()) {
+ // must make copy because this very code sometimes makes puts while iterating?!
+ Set<String> copy = new HashSet<String>(termFreqs.keySet());
+ for(String term : copy) {
if (termsEnum.seekExact(new BytesRef(term))) {
if (random().nextBoolean()) {
docs = termsEnum.docs(null, docs, DocsEnum.FLAG_FREQS);