From 1589ae176a68173aa8438a0850c711099674bc1c Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Sun, 17 Jul 2016 00:27:52 +0000 Subject: [PATCH] use real TempFile git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1753004 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/poifs/crypt/TestSecureTempZip.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSecureTempZip.java b/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSecureTempZip.java index 9993d939bf..4d4c5df345 100644 --- a/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSecureTempZip.java +++ b/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSecureTempZip.java @@ -45,6 +45,7 @@ import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.openxml4j.util.ZipEntrySource; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.util.IOUtils; +import org.apache.poi.util.TempFile; import org.apache.poi.xssf.XSSFTestDataSamples; import org.apache.poi.xssf.extractor.XSSFEventBasedExcelExtractor; import org.apache.poi.xssf.usermodel.XSSFWorkbook; @@ -58,7 +59,7 @@ public class TestSecureTempZip { */ @Test public void protectedTempZip() throws IOException, GeneralSecurityException, XmlException, OpenXML4JException { - final File tmpFile = new File("build/tmp", "protectedXlsx.zip"); + final File tmpFile = TempFile.createTempFile("protectedXlsx", ".zip"); File tikaProt = XSSFTestDataSamples.getSampleFile("protected_passtika.xlsx"); FileInputStream fis = new FileInputStream(tikaProt); POIFSFileSystem poifs = new POIFSFileSystem(fis); @@ -101,6 +102,7 @@ public class TestSecureTempZip { source.close(); poifs.close(); fis.close(); + tmpFile.delete(); } private void copyToFile(InputStream is, File tmpFile, CipherAlgorithm cipherAlgorithm, byte keyBytes[], byte ivBytes[]) throws IOException, GeneralSecurityException { -- 2.39.5