You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2020/02/06 16:13:51 UTC
[lucene-solr] branch branch_8x updated: LUCENE-9147: Make sure
temporary files get deleted on all code paths.
This is an automated email from the ASF dual-hosted git repository.
jpountz pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_8x by this push:
new 6a38079 LUCENE-9147: Make sure temporary files get deleted on all code paths.
6a38079 is described below
commit 6a380798a27e1ce777843a4322afba463e383acc
Author: Adrien Grand <jp...@gmail.com>
AuthorDate: Thu Feb 6 17:12:49 2020 +0100
LUCENE-9147: Make sure temporary files get deleted on all code paths.
---
.../apache/lucene/codecs/compressing/FieldsIndexWriter.java | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/compressing/FieldsIndexWriter.java b/lucene/core/src/java/org/apache/lucene/codecs/compressing/FieldsIndexWriter.java
index e67195e..9feda32 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/compressing/FieldsIndexWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/compressing/FieldsIndexWriter.java
@@ -80,21 +80,15 @@ public final class FieldsIndexWriter implements Closeable {
this.blockShift = blockShift;
this.ioContext = ioContext;
this.docsOut = dir.createTempOutput(name, codecName + "-doc_ids", ioContext);
- IndexOutput filePointersOut = null;
boolean success = false;
try {
CodecUtil.writeHeader(docsOut, codecName + "Docs", VERSION_CURRENT);
- this.filePointersOut = filePointersOut = dir.createTempOutput(name, codecName + "file_pointers", ioContext);
+ filePointersOut = dir.createTempOutput(name, codecName + "file_pointers", ioContext);
CodecUtil.writeHeader(filePointersOut, codecName + "FilePointers", VERSION_CURRENT);
success = true;
} finally {
if (success == false) {
- docsOut.close();
- dir.deleteFile(docsOut.getName());
- if (filePointersOut != null) {
- filePointersOut.close();
- dir.deleteFile(filePointersOut.getName());
- }
+ close();
}
}
}