diff options
author | Nick Burch <nick@apache.org> | 2014-07-24 18:58:27 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2014-07-24 18:58:27 +0000 |
commit | 7db6e8557e69b40bb4c8896aa380af8fe8732f46 (patch) | |
tree | bb07f15441a85e76bd17ab9c7b3815a70d09bec3 /src/ooxml/testcases/org/apache/poi/openxml4j | |
parent | e2f26b630c10fd34197c0d7f82f815f0417f18e0 (diff) | |
download | poi-7db6e8557e69b40bb4c8896aa380af8fe8732f46.tar.gz poi-7db6e8557e69b40bb4c8896aa380af8fe8732f46.zip |
Patch from Raúl Wegmann from bug #56735 / GitHub Pull #10 - Rationalise POI temp file creation to the TempFile util class, and allow a system wide setting of where Temp files (eg for SXSSF) go, via TempFile / TempFileCreationStrategy
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1613246 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/testcases/org/apache/poi/openxml4j')
-rw-r--r-- | src/ooxml/testcases/org/apache/poi/openxml4j/OpenXML4JTestDataSamples.java | 5 | ||||
-rw-r--r-- | src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java | 6 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/openxml4j/OpenXML4JTestDataSamples.java b/src/ooxml/testcases/org/apache/poi/openxml4j/OpenXML4JTestDataSamples.java index bf93681a4b..1c6b942a58 100644 --- a/src/ooxml/testcases/org/apache/poi/openxml4j/OpenXML4JTestDataSamples.java +++ b/src/ooxml/testcases/org/apache/poi/openxml4j/OpenXML4JTestDataSamples.java @@ -22,11 +22,10 @@ import org.apache.poi.util.TempFile; import java.io.File; import java.io.InputStream; +import java.io.IOException; /** * Centralises logic for finding/opening sample files for ooxml4j unit tests - * - * @author jmicich */ public final class OpenXML4JTestDataSamples { private static final POIDataSamples _samples = POIDataSamples.getOpenXML4JInstance(); @@ -46,7 +45,7 @@ public final class OpenXML4JTestDataSamples { return _samples.getFile(sampleFileName); } - public static File getOutputFile(String outputFileName) { + public static File getOutputFile(String outputFileName) throws IOException { String suffix = outputFileName.substring(outputFileName.lastIndexOf('.')); return TempFile.createTempFile(outputFileName, suffix); } diff --git a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java index 01116abcf9..fe5bb21d46 100644 --- a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java +++ b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java @@ -454,7 +454,7 @@ public final class TestPackage extends TestCase { * write changes to it. */ public void testOpenFileThenOverwrite() throws Exception { - File tempFile = File.createTempFile("poiTesting","tmp"); + File tempFile = TempFile.createTempFile("poiTesting","tmp"); File origFile = OpenXML4JTestDataSamples.getSampleFile("TestPackageCommon.docx"); FileHelper.copyFile(origFile, tempFile); @@ -491,8 +491,8 @@ public final class TestPackage extends TestCase { * to another file, then delete both */ public void testOpenFileThenSaveDelete() throws Exception { - File tempFile = File.createTempFile("poiTesting","tmp"); - File tempFile2 = File.createTempFile("poiTesting","tmp"); + File tempFile = TempFile.createTempFile("poiTesting","tmp"); + File tempFile2 = TempFile.createTempFile("poiTesting","tmp"); File origFile = OpenXML4JTestDataSamples.getSampleFile("TestPackageCommon.docx"); FileHelper.copyFile(origFile, tempFile); |