Bug 52062

Summary: [PATCH] SXSSF temporary files not deleted on Windows
Product: POI Reporter: Stefan Helfert <stefan.helfert>
Component: SXSSFAssignee: POI Developers List <dev>
Severity: normal CC: benjamin.bentmann
Priority: P2    
Version: 3.8-dev   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Attachments: Patch File created with ANT patch.xml
patchfile for fixing temporaryFile error
patch for issue
Program to reproduce the issue

Description Stefan Helfert 2011-10-20 09:06:14 UTC
Created attachment 27823 [details]
Patch File created with ANT patch.xml

The SXSSF API is creating two temporary files during the build process:


These two files wont by deleted after the vm got shutted down. (Tested on Windows XP Prof and Windows 7)

The source of these circumstance is that some streams are not closed and so the vm couldnt delete these two files.

I created a patch witch fixed this failure.
The two streams according to the two temp files are now closed and the vm can erase them.
I also fixed the missspelling of the two temp files:
poi-sxxsf -> poi-sxssf
Comment 1 Stefan Helfert 2011-10-20 09:34:50 UTC
Created attachment 27824 [details]
Comment 2 Stefan Helfert 2011-10-20 11:47:03 UTC
Created attachment 27826 [details]
patchfile for fixing temporaryFile error
Comment 3 Benjamin Bentmann 2011-10-20 13:29:40 UTC
Created attachment 27828 [details]
patch for issue

Alternative patch that closes resources in finally blocks to ensure files get closed in case of errors as well.
Comment 4 Alex Geller 2011-11-04 11:08:20 UTC
Created attachment 27894 [details]
Program to reproduce the issue

To find the temporary directory on Windows type %TEMP% into the "Search programs and files" edit at the bottom of the start menu. On my machine it is "C:\Users\Alex\AppData\Local\Temp".
Comment 5 Alex Geller 2011-11-04 11:10:22 UTC
Benjamin's patch looks good to me. I tested it on Windows with the small program supplied by Stefan (See attachment 27894 [details]). The temp files are removed on both normal and abnormal termination (Hit ^c when the program prompts for input).
Comment 6 Yegor Kozlov 2011-11-07 10:26:20 UTC
Applied in r1198693