mirror of
https://github.com/apache/lucene.git
synced 2025-02-08 02:58:58 +00:00
fix not-closing-on-exc bugs in BloomFilteringPF
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/slowclosing@1393552 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c4a735490e
commit
4485a42a03
@ -159,6 +159,7 @@ public final class BloomFilteringPostingsFormat extends PostingsFormat {
|
|||||||
String bloomFileName = IndexFileNames.segmentFileName(
|
String bloomFileName = IndexFileNames.segmentFileName(
|
||||||
state.segmentInfo.name, state.segmentSuffix, BLOOM_EXTENSION);
|
state.segmentInfo.name, state.segmentSuffix, BLOOM_EXTENSION);
|
||||||
IndexInput bloomIn = null;
|
IndexInput bloomIn = null;
|
||||||
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
bloomIn = state.dir.openInput(bloomFileName, state.context);
|
bloomIn = state.dir.openInput(bloomFileName, state.context);
|
||||||
CodecUtil.checkHeader(bloomIn, BLOOM_CODEC_NAME, BLOOM_CODEC_VERSION,
|
CodecUtil.checkHeader(bloomIn, BLOOM_CODEC_NAME, BLOOM_CODEC_VERSION,
|
||||||
@ -178,9 +179,14 @@ public final class BloomFilteringPostingsFormat extends PostingsFormat {
|
|||||||
FieldInfo fieldInfo = state.fieldInfos.fieldInfo(fieldNum);
|
FieldInfo fieldInfo = state.fieldInfos.fieldInfo(fieldNum);
|
||||||
bloomsByFieldName.put(fieldInfo.name, bloom);
|
bloomsByFieldName.put(fieldInfo.name, bloom);
|
||||||
}
|
}
|
||||||
|
success = true;
|
||||||
} finally {
|
} finally {
|
||||||
|
if (!success) {
|
||||||
|
IOUtils.close(bloomIn, delegateFieldsProducer);
|
||||||
|
} else {
|
||||||
IOUtils.close(bloomIn);
|
IOUtils.close(bloomIn);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user