OOM fix for gump run

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1677913 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2015-05-05 23:51:10 +00:00
parent c233d8db79
commit 36156dc87b
1 changed files with 13 additions and 1 deletions

View 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();
}
}