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
This commit is contained in:
Dominik Stadler 2015-12-31 08:23:04 +00:00
parent 3073f62b92
commit b4c4740f98
1 changed files with 9 additions and 13 deletions

View File

@ -47,18 +47,12 @@ public class XSSFFileHandler extends SpreadsheetHandler {
// ignore password protected files // ignore password protected files
if (POIXMLDocumentHandler.isEncrypted(stream)) return; if (POIXMLDocumentHandler.isEncrypted(stream)) return;
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(stream, out);
final byte[] bytes = out.toByteArray();
final XSSFWorkbook wb; 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 // use the combined handler for HSSF/XSSF
handleWorkbook(wb, ".xlsx"); handleWorkbook(wb, ".xlsx");
@ -72,6 +66,8 @@ public class XSSFFileHandler extends SpreadsheetHandler {
// and finally ensure that exporting to XML works // and finally ensure that exporting to XML works
exportToXML(wb); 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 // a test-case to test this locally without executing the full TestAllFiles
@Test @Test
public void test() throws Exception { 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 { try {
handleFile(stream); handleFile(stream);
} finally { } finally {
@ -130,6 +126,6 @@ public class XSSFFileHandler extends SpreadsheetHandler {
// a test-case to test this locally without executing the full TestAllFiles // a test-case to test this locally without executing the full TestAllFiles
@Test @Test
public void testExtractor() throws Exception { public void testExtractor() throws Exception {
handleExtracting(new File("test-data/spreadsheet/56278.xlsx")); handleExtracting(new File("test-data/spreadsheet/ref-56737.xlsx"));
} }
} }