Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

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

Robert Muir50c03e09ef83
diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java
index 671c9ffa753..cf0171df2db 100644
--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java
+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java
@@ -959,11 +959,11 @@ public final class MemoryPostingsFormat extends PostingsFormat {
public FieldsProducer fieldsProducer(SegmentReadState state) throws IOException {
final String fileName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, EXTENSION);
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<>();
try {
+ CodecUtil.checkHeader(in, CODEC_NAME, VERSION_START, VERSION_CURRENT);
while(true) {
final int termCount = in.readVInt();
if (termCount == 0) {