diff options
author | PJ Fanning <fanningpj@apache.org> | 2021-12-28 12:36:51 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2021-12-28 12:36:51 +0000 |
commit | d442ea645c543fd86a41ca9a88f96b8e0c0aae4d (patch) | |
tree | 8feaa0264ffafb7276a6fb6265cd1a7b4a436630 /poi-examples/src | |
parent | 57852e0c7d82eb0b547b1550490e72962ba0715d (diff) | |
download | poi-d442ea645c543fd86a41ca9a88f96b8e0c0aae4d.tar.gz poi-d442ea645c543fd86a41ca9a88f96b8e0c0aae4d.zip |
[bug-65772] stop using deleteOnExit in DefaultTempFileCreationStrategy
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1896474 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-examples/src')
-rw-r--r-- | poi-examples/src/main/java/org/apache/poi/examples/xssf/usermodel/BigGridDemo.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/poi-examples/src/main/java/org/apache/poi/examples/xssf/usermodel/BigGridDemo.java b/poi-examples/src/main/java/org/apache/poi/examples/xssf/usermodel/BigGridDemo.java index 18c9c23c0e..bca850186d 100644 --- a/poi-examples/src/main/java/org/apache/poi/examples/xssf/usermodel/BigGridDemo.java +++ b/poi-examples/src/main/java/org/apache/poi/examples/xssf/usermodel/BigGridDemo.java @@ -84,6 +84,7 @@ public final class BigGridDemo { // Step 1. Create a template file. Setup sheets and workbook-level objects such as // cell styles, number formats, etc. + File tmp = null; try (XSSFWorkbook wb = new XSSFWorkbook()) { XSSFSheet sheet = wb.createSheet("Big Grid"); @@ -97,7 +98,7 @@ public final class BigGridDemo { } //Step 2. Generate XML file. - File tmp = File.createTempFile("sheet", ".xml"); + tmp = File.createTempFile("sheet", ".xml"); try ( FileOutputStream stream = new FileOutputStream(tmp); Writer fw = new OutputStreamWriter(stream, XML_ENCODING) @@ -109,6 +110,8 @@ public final class BigGridDemo { try (FileOutputStream out = new FileOutputStream("big-grid.xlsx")) { substitute(new File("template.xlsx"), tmp, sheetRef.substring(1), out); } + } finally { + if (tmp != null) tmp.delete(); } } |