LUCENE-1314: add asserts during *Reader.clone() that the incoming SegmentInfo/s matches the current reader

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@746343 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2009-02-20 19:37:25 +00:00
parent 36438c1ee7
commit f8dc3bbd7d
2 changed files with 8 additions and 0 deletions

View File

@ -106,6 +106,10 @@ class MultiSegmentReader extends DirectoryIndexReader implements Cloneable {
try {
SegmentReader newReader;
if (newReaders[i] == null || infos.info(i).getUseCompoundFile() != newReaders[i].getSegmentInfo().getUseCompoundFile()) {
// We should never see a totally new segment during cloning
assert !doClone;
// this is a new reader; in case we hit an exception we can close it safely
newReader = SegmentReader.get(readOnly, infos.info(i));
} else {

View File

@ -671,6 +671,10 @@ class SegmentReader extends DirectoryIndexReader {
return this;
}
// When cloning, the incoming SegmentInfos should not
// have any changes in it:
assert !doClone || (normsUpToDate && deletionsUpToDate);
// clone reader
SegmentReader clone;
try {