diff --git a/lucene/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java b/lucene/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java index 57072463ca0..f3893665c91 100644 --- a/lucene/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java +++ b/lucene/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java @@ -74,39 +74,51 @@ public class PreFlexFields extends FieldsProducer { if (indexDivisor < 0) { indexDivisor = -indexDivisor; } + + boolean success = false; + try { + TermInfosReader r = new TermInfosReader(dir, info.name, fieldInfos, readBufferSize, indexDivisor); + if (indexDivisor == -1) { + tisNoIndex = r; + } else { + tisNoIndex = null; + tis = r; + } + this.readBufferSize = readBufferSize; + this.fieldInfos = fieldInfos; - TermInfosReader r = new TermInfosReader(dir, info.name, fieldInfos, readBufferSize, indexDivisor); - if (indexDivisor == -1) { - tisNoIndex = r; - } else { - tisNoIndex = null; - tis = r; - } - this.readBufferSize = readBufferSize; - this.fieldInfos = fieldInfos; - - // make sure that all index files have been read or are kept open - // so that if an index update removes them we'll still have them - freqStream = dir.openInput(info.name + ".frq", readBufferSize); - boolean anyProx = false; - final int numFields = fieldInfos.size(); - for(int i=0;i