LUCENE-2135: don't flush field cache if we hit exception during init (it leads to NPE)

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@890439 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2009-12-14 18:59:21 +00:00
parent c67b43ef34
commit 86039cdb36
1 changed files with 6 additions and 1 deletions

View File

@ -106,7 +106,6 @@ public class SegmentReader extends IndexReader implements Cloneable {
segment = si.name;
this.readBufferSize = readBufferSize;
this.dir = dir;
this.origInstance = origInstance;
boolean success = false;
@ -144,6 +143,12 @@ public class SegmentReader extends IndexReader implements Cloneable {
decRef();
}
}
// Must assign this at the end -- if we hit an
// exception above core, we don't want to attempt to
// purge the FieldCache (will hit NPE because core is
// not assigned yet).
this.origInstance = origInstance;
}
synchronized TermVectorsReader getTermVectorsReaderOrig() {