]> source.dussan.org Git - poi.git/commitdiff
Revert changes to integration-test-framework to not make tests fail with strange...
authorDominik Stadler <centic@apache.org>
Thu, 31 Dec 2015 08:23:04 +0000 (08:23 +0000)
committerDominik Stadler <centic@apache.org>
Thu, 31 Dec 2015 08:23:04 +0000 (08:23 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1722425 13f79535-47bb-0310-9956-ffa450edef68

src/integrationtest/org/apache/poi/stress/XSSFFileHandler.java

index 414809c00c5b979114432c83bb8b6b0fb6274dc8..4de2dbd8ebf54528ed14bd913d03472f9822ab32 100644 (file)
@@ -47,19 +47,13 @@ public class XSSFFileHandler extends SpreadsheetHandler {
         // ignore password protected files
         if (POIXMLDocumentHandler.isEncrypted(stream)) return;
 
-        final XSSFWorkbook wb;
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        IOUtils.copy(stream, out);
 
-        // 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)));
+        final byte[] bytes = out.toByteArray();
+        final XSSFWorkbook wb;
+        wb = new XSSFWorkbook(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