Bug 56735 - [PATCH] Use custom temporary file directory in SXSSF
Summary: [PATCH] Use custom temporary file directory in SXSSF
Alias: None
Product: POI
Classification: Unclassified
Component: SXSSF (show other bugs)
Version: 3.11-dev
Hardware: PC All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2014-07-17 06:35 UTC by Raúl Wegmann
Modified: 2014-07-24 18:59 UTC (History)
1 user (show)

Patch that allows to optionally specify a custom temporary file directory in SXSSF (1.58 KB, application/x-gzip)
2014-07-17 06:35 UTC, Raúl Wegmann

Note You need to log in before you can comment on or make changes to this bug.
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!