]> source.dussan.org Git - poi.git/commitdiff
OOM fix for gump run
authorAndreas Beeker <kiwiwings@apache.org>
Tue, 5 May 2015 23:51:10 +0000 (23:51 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Tue, 5 May 2015 23:51:10 +0000 (23:51 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1677913 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java

index 4fc0db1576721ecb8f52fa5759f8e7c4c5e775fb..365ed2270c02227b58e7c3a56823e9e47164a1a4 100644 (file)
@@ -2463,7 +2463,17 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
             c.setCellValue(i);
         }
         
-        wb = XSSFTestDataSamples.writeOutAndReadBack(wb);
+        // using temp file instead of ByteArrayOutputStream because of OOM in gump run
+        File tmp = TempFile.createTempFile("poi-test", ".bug57880");
+        FileOutputStream fos = new FileOutputStream(tmp);
+        wb.write(fos);
+        fos.close();
+        
+        wb.close();
+        fmt = null; s = null; wb = null;
+        // System.gc();
+        
+        wb = new XSSFWorkbook(tmp);
         fmt = wb.getCreationHelper().createDataFormat();
         s = wb.getSheetAt(0);
         for (int i=1; i<numStyles; i++) {
@@ -2473,5 +2483,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
             assertEquals(164+i, style.getDataFormat()&0xffff);
             assertEquals("test"+i, style.getDataFormatString());
         }
+        wb.close();
+        tmp.delete();
     }
 }