delete file on exc during write

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1393833 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2012-10-03 23:41:55 +00:00
parent 4e04d7b8b9
commit da1c35cf31
1 changed files with 4 additions and 0 deletions

View File

@ -128,6 +128,10 @@ public class SimpleTextSegmentInfoWriter extends SegmentInfoWriter {
} finally { } finally {
if (!success) { if (!success) {
IOUtils.closeWhileHandlingException(output); IOUtils.closeWhileHandlingException(output);
try {
dir.deleteFile(segFileName);
} catch (Throwable t) {
}
} else { } else {
output.close(); output.close();
} }