ASF Bugzilla – Attachment 29032 Details for
Bug 53493
delete xml's temporary files when write workbook
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Command line application to test SXSSF temp file removal in finalize()
PoiTempFileRemovalTest.java (text/plain), 1.78 KB, created by
Alex Geller
on 2012-07-05 09:11:59 UTC
(
hide
)
Description:
Command line application to test SXSSF temp file removal in finalize()
Filename:
MIME Type:
Creator:
Alex Geller
Created:
2012-07-05 09:11:59 UTC
Size:
1.78 KB
patch
obsolete
>import org.apache.poi.xssf.streaming.SXSSFWorkbook; >import java.io.FileOutputStream; >import java.io.IOException; >import org.apache.poi.ss.usermodel.Row; >import org.apache.poi.ss.usermodel.Cell; >import org.apache.poi.ss.usermodel.Sheet; >import org.apache.poi.ss.usermodel.Workbook; >import org.apache.poi.ss.util.CellReference; >import java.lang.ref.WeakReference; >public class PoiTempFileRemovalTest >{ > public static void main(String[] args) throws IOException { > System.out.println("create workbook"); > Workbook wb = new SXSSFWorkbook(100); > { > Sheet sh = wb.createSheet(); > for (int rownum = 0; rownum < 1000; rownum++) { > Row row = sh.createRow(rownum); > for (int cellnum = 0; cellnum < 10; cellnum++) { > Cell cell = row.createCell(cellnum); > String address = new CellReference(cell).formatAsString(); > cell.setCellValue(address); > } > > } > FileOutputStream out = new FileOutputStream("testsxssf.xlsx"); > wb.write(out); > out.close(); > } > > > System.out.println("Temp files should now be present, press enter to continue.."); > > WeakReference wr=new WeakReference(wb); > wb=null; // loose all references to the workbook > > Runtime.getRuntime().gc(); // without this it may not be reclaimed > > while(System.in.read()!=-1) > { > if(wr.get()!=null) > { > System.out.println("Sheet not garbage collected yet, press enter to continue.."); > } > else > { > System.out.println("Sheet was garbage collected, the temp file should be removed"); > System.exit(0); > } > } > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 53493
:
29018
| 29032