Bug 56735

Summary: [PATCH] Use custom temporary file directory in SXSSF
Product: POI Reporter: Raúl Wegmann <raul.wegmann>
Component: SXSSFAssignee: POI Developers List <dev>
Severity: enhancement CC: raul.wegmann
Priority: P2    
Version: 3.11-dev   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Patch that allows to optionally specify a custom temporary file directory in SXSSF

Description Raúl Wegmann 2014-07-17 06:35:36 UTC
Created attachment 31825 [details]
Patch that allows to optionally specify a custom temporary file directory in SXSSF

The temporary files generated when using a SXSSFWorkbook are stored in the default system temp directory. 

As our application is deployed together with other applications on the same application server, we are not allowed to change the java.io.tmpdir system property. Further, subclassing the SXSSFWorkbook and related classes is made difficult because many methods are package protected.

Therefore we would like you to consider the inclusion of the attached patch, which optionally allows to set a temp file directory property on the SXSSFWorkbook. The API changes are backward compatible.
Comment 1 Nick Burch 2014-07-17 13:09:09 UTC
We already have temp file helpers in POI, so it's a surprise to see that sxssf isn't apparently using that - org.apache.poi.util.TempFile

I'd probably rather we get SXSSF following the rest of POI in using that, then think about ways to allow you to override where that stores its files
Comment 2 Raúl Wegmann 2014-07-18 12:21:58 UTC
Thanks for pointing out the existing infrastructure. I will work on a new set of patches for you to review.
Comment 3 Raúl Wegmann 2014-07-18 21:22:25 UTC
Please see the pull request at https://github.com/apache/poi/pull/10 for a set of changes that would implement this feature using the org.apache.poi.util.TempFile class and let me know what you think.
Comment 4 Nick Burch 2014-07-24 18:59:31 UTC
Thanks for this, patch applied in r1613246.

If you could review and close the GitHub pull request, that'd be great!