don't leak a file handle on exception (trunk only)

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1620095 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2014-08-23 23:48:38 +00:00
parent c04d56c183
commit 50c03e09ef
1 changed files with 1 additions and 1 deletions

View File

@ -959,11 +959,11 @@ public final class MemoryPostingsFormat extends PostingsFormat {
public FieldsProducer fieldsProducer(SegmentReadState state) throws IOException { public FieldsProducer fieldsProducer(SegmentReadState state) throws IOException {
final String fileName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, EXTENSION); final String fileName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, EXTENSION);
final ChecksumIndexInput in = state.directory.openChecksumInput(fileName, IOContext.READONCE); final ChecksumIndexInput in = state.directory.openChecksumInput(fileName, IOContext.READONCE);
CodecUtil.checkHeader(in, CODEC_NAME, VERSION_START, VERSION_CURRENT);
final SortedMap<String,TermsReader> fields = new TreeMap<>(); final SortedMap<String,TermsReader> fields = new TreeMap<>();
try { try {
CodecUtil.checkHeader(in, CODEC_NAME, VERSION_START, VERSION_CURRENT);
while(true) { while(true) {
final int termCount = in.readVInt(); final int termCount = in.readVInt();
if (termCount == 0) { if (termCount == 0) {