When removing a SXSSF sheet, ensure temp files associated with it are disposed of #57666

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1676833 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2015-04-29 19:28:26 +00:00
parent b2a1862f19
commit b3bd87d3c2

View File

@ -709,9 +709,16 @@ public class SXSSFWorkbook implements Workbook
@Override @Override
public void removeSheetAt(int index) public void removeSheetAt(int index)
{ {
XSSFSheet xSheet=_wb.getSheetAt(index); // Get the sheet to be removed
XSSFSheet xSheet = _wb.getSheetAt(index);
SXSSFSheet sxSheet = getSXSSFSheet(xSheet);
// De-register it
_wb.removeSheetAt(index); _wb.removeSheetAt(index);
deregisterSheetMapping(xSheet); deregisterSheetMapping(xSheet);
// Clean up temporary resources
sxSheet.dispose();
} }
/** /**