You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2011/11/08 05:32:47 UTC

svn commit: r1199101 - /lucene/dev/trunk/lucene/src/test-framework/java/org/apache/lucene/index/RandomCodec.java

Author: rmuir
Date: Tue Nov  8 04:32:47 2011
New Revision: 1199101

URL: http://svn.apache.org/viewvc?rev=1199101&view=rev
Log:
LUCENE-3490: add back sync to fix bug when infostream is on

Modified:
    lucene/dev/trunk/lucene/src/test-framework/java/org/apache/lucene/index/RandomCodec.java

Modified: lucene/dev/trunk/lucene/src/test-framework/java/org/apache/lucene/index/RandomCodec.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test-framework/java/org/apache/lucene/index/RandomCodec.java?rev=1199101&r1=1199100&r2=1199101&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test-framework/java/org/apache/lucene/index/RandomCodec.java (original)
+++ lucene/dev/trunk/lucene/src/test-framework/java/org/apache/lucene/index/RandomCodec.java Tue Nov  8 04:32:47 2011
@@ -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