]> source.dussan.org Git - poi.git/commitdiff
bug 60742: write out to unit test TempFile rather than Unix-only /tmp/60512.xlsx...
authorJaven O'Neal <onealj@apache.org>
Fri, 17 Feb 2017 16:57:43 +0000 (16:57 +0000)
committerJaven O'Neal <onealj@apache.org>
Fri, 17 Feb 2017 16:57:43 +0000 (16:57 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1783426 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/xssf/TestXSSFCloneSheet.java

index 1c3cfe25dc1cbdbc1ac79b343ca268719c114177..c2c2375e780e2f9ce173c623a52c0c3f6a5c8ba1 100644 (file)
@@ -25,11 +25,13 @@ import org.apache.poi.hssf.HSSFITestDataProvider;
 import org.apache.poi.ss.usermodel.BaseTestCloneSheet;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.util.TempFile;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.junit.Before;
 import org.junit.Test;
 
+import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
@@ -81,11 +83,13 @@ public class TestXSSFCloneSheet  extends BaseTestCloneSheet {
         assertNotNull(wbBack);
         wbBack.close();
 
-        OutputStream str = new FileOutputStream("/tmp/60512.xlsx");
+        // FIXME: why are we doing both writeOutAndReadBack and write? Was the temp file created for manual debugging?
+        File tmp = TempFile.createTempFile("60512.xlsx", ".tmp");
+        OutputStream ostream = new FileOutputStream(tmp);
         try {
-            wb.write(str);
+            wb.write(ostream);
         } finally {
-            str.close();
+            ostream.close();
         }
 
         wb.close();