Bug 52062 - [PATCH] SXSSF temporary files not deleted on Windows
Summary: [PATCH] SXSSF temporary files not deleted on Windows
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: SXSSF (show other bugs)
Version: 3.8-dev
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-20 09:06 UTC by Stefan Helfert
Modified: 2011-11-07 10:26 UTC (History)
1 user (show)



Attachments
Patch File created with ANT patch.xml (441 bytes, patch)
2011-10-20 09:06 UTC, Stefan Helfert
Details | Diff
TextfileOutput (2.21 KB, text/plain)
2011-10-20 09:34 UTC, Stefan Helfert
Details
patchfile for fixing temporaryFile error (1.95 KB, patch)
2011-10-20 11:47 UTC, Stefan Helfert
Details | Diff
patch for issue (4.03 KB, patch)
2011-10-20 13:29 UTC, Benjamin Bentmann
Details | Diff
Program to reproduce the issue (1.86 KB, application/octet-stream)
2011-11-04 11:08 UTC, Alex Geller
Details

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

poi-sxxsf-sheet.xml
poi-sxxsf-template.xlsx

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]
TextfileOutput
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

Thanks,
Yegor