ASF Bugzilla – Attachment 27828 Details for
Bug 52062
[PATCH] SXSSF temporary files not deleted on Windows
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for issue
tmp-file-leak.patch (text/plain), 4.03 KB, created by
Benjamin Bentmann
on 2011-10-20 13:29:40 UTC
(
hide
)
Description:
patch for issue
Filename:
MIME Type:
Creator:
Benjamin Bentmann
Created:
2011-10-20 13:29:40 UTC
Size:
4.03 KB
patch
obsolete
>Index: src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java >=================================================================== >--- src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java (revision 1186765) >+++ src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java (working copy) >@@ -1284,7 +1284,7 @@ > > public SheetDataWriter() throws IOException > { >- _fd = File.createTempFile("poi-sxxsf-sheet", ".xml"); >+ _fd = File.createTempFile("poi-sxssf-sheet", ".xml"); > _fd.deleteOnExit(); > _out = new BufferedWriter(new FileWriter(_fd)); > } > >Property changes on: src\ooxml\java\org\apache\poi\xssf\streaming\SXSSFSheet.java >___________________________________________________________________ >Added: svn:eol-style > + native > >Index: src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java >=================================================================== >--- src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java (revision 1186765) >+++ src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java (working copy) >@@ -186,30 +186,48 @@ > private void injectData(File zipfile, OutputStream out) throws IOException > { > ZipFile zip = new ZipFile(zipfile); >- >- ZipOutputStream zos = new ZipOutputStream(out); >- >- @SuppressWarnings("unchecked") >- Enumeration<ZipEntry> en = (Enumeration<ZipEntry>) zip.entries(); >- while (en.hasMoreElements()) >+ try > { >- ZipEntry ze = en.nextElement(); >- zos.putNextEntry(new ZipEntry(ze.getName())); >- InputStream is = zip.getInputStream(ze); >- XSSFSheet xSheet=getSheetFromZipEntryName(ze.getName()); >- if(xSheet!=null) >+ ZipOutputStream zos = new ZipOutputStream(out); >+ try > { >- SXSSFSheet sxSheet=getSXSSFSheet(xSheet); >- copyStreamAndInjectWorksheet(is,zos,sxSheet.getWorksheetXMLInputStream()); >+ @SuppressWarnings("unchecked") >+ Enumeration<ZipEntry> en = (Enumeration<ZipEntry>) zip.entries(); >+ while (en.hasMoreElements()) >+ { >+ ZipEntry ze = en.nextElement(); >+ zos.putNextEntry(new ZipEntry(ze.getName())); >+ InputStream is = zip.getInputStream(ze); >+ XSSFSheet xSheet=getSheetFromZipEntryName(ze.getName()); >+ if(xSheet!=null) >+ { >+ SXSSFSheet sxSheet=getSXSSFSheet(xSheet); >+ InputStream xis = sxSheet.getWorksheetXMLInputStream(); >+ try >+ { >+ copyStreamAndInjectWorksheet(is,zos,xis); >+ } >+ finally >+ { >+ xis.close(); >+ } >+ } >+ else >+ { >+ copyStream(is, zos); >+ } >+ is.close(); >+ } > } >- else >+ finally > { >- copyStream(is, zos); >+ zos.close(); > } >- is.close(); > } >- >- zos.close(); >+ finally >+ { >+ zip.close(); >+ } > } > private static void copyStream(InputStream in, OutputStream out) throws IOException { > byte[] chunk = new byte[1024]; >@@ -649,7 +667,7 @@ > } > > //Save the template >- File tmplFile = File.createTempFile("poi-sxxsf-template", ".xlsx"); >+ File tmplFile = File.createTempFile("poi-sxssf-template", ".xlsx"); > tmplFile.deleteOnExit(); > FileOutputStream os = new FileOutputStream(tmplFile); > _wb.write(os); > >Property changes on: src\ooxml\java\org\apache\poi\xssf\streaming\SXSSFWorkbook.java >___________________________________________________________________ >Added: svn:eol-style > + native >
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 52062
:
27823
|
27824
|
27826
| 27828 |
27894