From b4c4740f98762d40665af4454b54813f8a7f1815 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Thu, 31 Dec 2015 08:23:04 +0000 Subject: [PATCH] Revert changes to integration-test-framework to not make tests fail with strange errors about entity expansion limits git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1722425 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/stress/XSSFFileHandler.java | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/integrationtest/org/apache/poi/stress/XSSFFileHandler.java b/src/integrationtest/org/apache/poi/stress/XSSFFileHandler.java index 414809c00c..4de2dbd8eb 100644 --- a/src/integrationtest/org/apache/poi/stress/XSSFFileHandler.java +++ b/src/integrationtest/org/apache/poi/stress/XSSFFileHandler.java @@ -47,19 +47,13 @@ public class XSSFFileHandler extends SpreadsheetHandler { // ignore password protected files if (POIXMLDocumentHandler.isEncrypted(stream)) return; + ByteArrayOutputStream out = new ByteArrayOutputStream(); + IOUtils.copy(stream, out); + + final byte[] bytes = out.toByteArray(); final XSSFWorkbook wb; + wb = new XSSFWorkbook(new ByteArrayInputStream(bytes)); - // make sure the potentially large byte-array is freed up quickly again - { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - IOUtils.copy(stream, out); - final byte[] bytes = out.toByteArray(); - - checkXSSFReader(OPCPackage.open(new ByteArrayInputStream(bytes))); - - wb = new XSSFWorkbook(new ByteArrayInputStream(bytes)); - } - // use the combined handler for HSSF/XSSF handleWorkbook(wb, ".xlsx"); @@ -72,6 +66,8 @@ public class XSSFFileHandler extends SpreadsheetHandler { // and finally ensure that exporting to XML works exportToXML(wb); + + checkXSSFReader(OPCPackage.open(new ByteArrayInputStream(bytes))); } @@ -119,7 +115,7 @@ public class XSSFFileHandler extends SpreadsheetHandler { // a test-case to test this locally without executing the full TestAllFiles @Test public void test() throws Exception { - InputStream stream = new BufferedInputStream(new FileInputStream("test-data/openxml4j/50154.xlsx")); + InputStream stream = new BufferedInputStream(new FileInputStream("test-data/spreadsheet/ref-56737.xlsx")); try { handleFile(stream); } finally { @@ -130,6 +126,6 @@ public class XSSFFileHandler extends SpreadsheetHandler { // a test-case to test this locally without executing the full TestAllFiles @Test public void testExtractor() throws Exception { - handleExtracting(new File("test-data/spreadsheet/56278.xlsx")); + handleExtracting(new File("test-data/spreadsheet/ref-56737.xlsx")); } } \ No newline at end of file