Jaechang Nam created LUCENE-7584: ------------------------------------ Summary: Potential leak issue Key: LUCENE-7584 URL: https://issues.apache.org/jira/browse/LUCENE-7584 Project: Lucene - Core Issue Type: Bug Reporter: Jaechang Nam Priority: Trivial
May the following method have a potential leak like LUCENE-3251 when directory.createOutput(fileName) throws IOException? (Found the code from the recent code snapshot) lucene/src/java/org/apache/lucene/index/CompoundFileWriter.java public void close() throws IOException { if (merged) throw new IllegalStateException("Merge already performed"); if (entries.isEmpty()) throw new IllegalStateException("No entries to merge have been defined"); merged = true; // open the compound stream IndexOutput os = directory.createOutput(fileName); IOException priorException = null; try { // Write the Version info - must be a VInt because CFR reads a VInt // in older versions! os.writeVInt(FORMAT_CURRENT); // Write the number of entries os.writeVInt(entries.size()); // Write the directory with all offsets at 0. // Remember the positions of directory entries so that we can // adjust the offsets later long totalSize = 0; for (FileEntry fe : entries) { fe.directoryOffset = os.getFilePointer(); os.writeLong(0); // for now os.writeString(IndexFileNames.stripSegmentName(fe.file)); totalSize += directory.fileLength(fe.file); } // Pre-allocate size of file as optimization -- ... } catch (IOException e) { priorException = e; } finally { IOUtils.closeSafely(priorException, os); } } -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org