fix not-closing-on-exc bugs in BlockTreeTermsReader

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/slowclosing@1393550 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2012-10-03 15:32:01 +00:00
parent a97703f1df
commit c4a735490e
1 changed files with 5 additions and 3 deletions

View File

@ -172,12 +172,14 @@ public class BlockTreeTermsReader extends FieldsProducer {
throw new CorruptIndexException("duplicate field: " + fieldInfo.name + " (resource=" + in + ")");
}
}
if (indexDivisor != -1) {
indexIn.close();
}
success = true;
} finally {
if (!success) {
IOUtils.closeWhileHandlingException(indexIn, this);
} else if (indexDivisor != -1) {
indexIn.close();
IOUtils.closeWhileHandlingException(in, indexIn, this);
}
}
}