From 15212e0feb7952873f4acfd2301fe21b72c821b9 Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Tue, 20 Jun 2017 06:08:38 +0000 Subject: [PATCH] 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 --- .../apache/poi/xssf/streaming/TestSXSSFWorkbook.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java index 9179362fa..c43f46e1a 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java @@ -580,22 +580,16 @@ public final class TestSXSSFWorkbook extends BaseTestXWorkbook { @Test 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 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); assertNotNull(wbBack); wbBack.close(); - /*FileOutputStream out = new FileOutputStream("C:/temp/out.xlsx"); - try { - wb.write(out); - } finally { - out.close(); - }*/ - wb.close(); } }