Apache Lucene open-source search software
LUCENE-3490: add back sync to fix bug when infostream is on
Robert Muir29aeb3507eef
diff --git a/lucene/src/test-framework/java/org/apache/lucene/index/RandomCodec.java b/lucene/src/test-framework/java/org/apache/lucene/index/RandomCodec.javaindex 72163904c27..79f11b47521 100644--- a/lucene/src/test-framework/java/org/apache/lucene/index/RandomCodec.java+++ b/lucene/src/test-framework/java/org/apache/lucene/index/RandomCodec.java@@ -51,8 +51,10 @@ import org.apache.lucene.util._TestUtil;public class RandomCodec extends Lucene40Codec {/** shuffled list of postingsformats to use for new mappings */private List<PostingsFormat> formats = new ArrayList<PostingsFormat>();- /** memorized field->postingsformat mappings */- private Map<String,PostingsFormat> previousMappings = new HashMap<String,PostingsFormat>();+ // note: we have to sync this map even though its just for debugging/toString,+ // otherwise DWPT's .toString() calls that iterate over the map can+ // cause concurrentmodificationexception if indexwriter's infostream is on+ private Map<String,PostingsFormat> previousMappings = Collections.synchronizedMap(new HashMap<String,PostingsFormat>());private final int perFieldSeed;@Override