bug 60742: write out to unit test TempFile rather than Unix-only /tmp/60512.xlsx; patch from Chiara Marcheschi

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1783426 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2017-02-17 16:57:43 +00:00
parent 7fcaaa9479
commit b2206fc40f
1 changed files with 7 additions and 3 deletions

View 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();