Issue Details (XML | Word | Printable)

Key: FILEUPLOAD-61
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Faustas Zilinskas
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons FileUpload

Temporary upload files are not being deleted

Created: 13/Feb/03 11:04 PM   Updated: 09/Mar/07 08:32 PM
Return to search
Component/s: None
Affects Version/s: Nightly Builds
Fix Version/s: None

Time Tracking:
Not Specified

Environment:
Operating System: All
Platform: PC

Bugzilla Id: 17043


 Description  « Hide
In my multipart form I have one simple form parameter and 3 "file" type
parameters.
When I upload and parse it with Fileupload, 4 files get created.

After I'm done with the request,
I'm calling FileItem.delete() for all of them, but only three files get
deleted: the one that contains the simple form
parameter doesn't get deleted. When I try to delete it manually, I get
"Sharing violation error", which means
that there is another process who has the file open. Only after I
shutdown the JVM I can delete the file.

In order to solve the problem, all I did was to add fis.close() in the
DefaultFileItem.get():
try

{ FileInputStream fis = new FileInputStream(storeLocation); fis.read(content); --->fis.close();<--- }

catch (Exception e)

{ content = null; }

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
David Graham added a comment - 26/Feb/03 03:53 AM
I'm not too familiar with this code but it seems like the suggested fis.close()
call should be in the finally block, not the try block.

Martin Cooper added a comment - 02/Mar/03 05:20 AM
Fixed in the 20030302 nightly build.