bug 56557: open test-data/spreadsheet/56557.xlsx such that the unit test test56557() does not leave a modified file on disk after running.

I verified that
> Workbook wb = XSSFTestDataSamples.openSampleWorkbook("56557.xlsx")
and
> Workbook wb = WorkbookFactory.create(XSSFTestDataSamples.getSampleFile("56557.xlsx"), password=null, readOnly=false);
both fail when the fix from r1798913 for SXSSFWorkbook is not applied and both pass when the fix is applied.

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1799304 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2017-06-20 06:08:38 +00:00
parent 4d692223bb
commit 15212e0feb

View File

@ -580,22 +580,16 @@ public final class TestSXSSFWorkbook extends BaseTestXWorkbook {
@Test @Test
public void test56557() throws IOException, InvalidFormatException { public void test56557() throws IOException, InvalidFormatException {
Workbook wb = WorkbookFactory.create(XSSFTestDataSamples.getSampleFile("56557.xlsx"), null, false); Workbook wb = XSSFTestDataSamples.openSampleWorkbook("56557.xlsx");
// Using streaming XSSFWorkbook makes the output file invalid // Using streaming XSSFWorkbook makes the output file invalid
wb = new SXSSFWorkbook(((XSSFWorkbook) wb)); wb = new SXSSFWorkbook(((XSSFWorkbook) wb));
// Should not throw POIXMLException: java.io.IOException: Unable to parse xml bean when reading back
Workbook wbBack = XSSFTestDataSamples.writeOutAndReadBack(wb); Workbook wbBack = XSSFTestDataSamples.writeOutAndReadBack(wb);
assertNotNull(wbBack); assertNotNull(wbBack);
wbBack.close(); wbBack.close();
/*FileOutputStream out = new FileOutputStream("C:/temp/out.xlsx");
try {
wb.write(out);
} finally {
out.close();
}*/
wb.close(); wb.close();
} }
} }