remove finalizer

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894490 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2021-10-22 18:09:26 +00:00
parent 7416d8035a
commit 5d79f841bb
4 changed files with 6 additions and 0 deletions

View File

@ -56,6 +56,7 @@ public class DeferredGeneration {
//writeAvoidingTempFiles was added as an experimental change in POI 5.1.0
//wb.writeAvoidingTempFiles(fileOut);
} finally {
//the dispose call is necessary to ensure temp files are removed
wb.dispose();
}
System.out.println("wrote DeferredGeneration.xlsx");

View File

@ -47,6 +47,7 @@ public class Outlining {
try (FileOutputStream fileOut = new FileOutputStream("outlining_collapsed.xlsx")) {
wb2.write(fileOut);
} finally {
//the dispose call is necessary to ensure temp files are removed
wb2.dispose();
}
}

View File

@ -80,6 +80,7 @@ public final class SavePasswordProtectedXlsx {
}
} finally {
wb.close();
//the dispose call is necessary to ensure temp files are removed
wb.dispose();
}
TempFileUtils.checkTempFiles();

View File

@ -152,6 +152,9 @@ public class SheetDataWriter implements Closeable {
*/
public InputStream getWorksheetXMLInputStream() throws IOException {
File fd = getTempFile();
if (fd == null) {
throw new IOException("getWorksheetXMLInputStream only works when a temp file is used");
}
FileInputStream fis = new FileInputStream(fd);
try {
return decorateInputStream(fis);