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 2012/09/06 15:11:36 UTC
svn commit: r1381589 -
/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/CompoundFileDirectory.java
Author: rmuir
Date: Thu Sep 6 13:11:36 2012
New Revision: 1381589
URL: http://svn.apache.org/viewvc?rev=1381589&view=rev
Log:
LUCENE-4196: hard check not assert
Modified:
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/CompoundFileDirectory.java
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/CompoundFileDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/CompoundFileDirectory.java?rev=1381589&r1=1381588&r2=1381589&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/CompoundFileDirectory.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/CompoundFileDirectory.java Thu Sep 6 13:11:36 2012
@@ -20,6 +20,7 @@ package org.apache.lucene.store;
import org.apache.lucene.codecs.Codec; // javadocs
import org.apache.lucene.codecs.CodecUtil;
import org.apache.lucene.codecs.LiveDocsFormat; // javadocs
+import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexFileNames;
import org.apache.lucene.index.IndexFormatTooOldException;
import org.apache.lucene.store.DataOutput; // javadocs
@@ -142,8 +143,10 @@ public final class CompoundFileDirectory
for (int i = 0; i < numEntries; i++) {
final FileEntry fileEntry = new FileEntry();
final String id = entriesStream.readString();
- assert !mapping.containsKey(id): "id=" + id + " was written multiple times in the CFS";
- mapping.put(id, fileEntry);
+ FileEntry previous = mapping.put(id, fileEntry);
+ if (previous != null) {
+ throw new CorruptIndexException("Duplicate cfs entry id=" + id + " in CFS: " + entriesStream);
+ }
fileEntry.offset = entriesStream.readLong();
fileEntry.length = entriesStream.readLong();
}