-
1. Re: fileUpload keeps temp files open
vladimirmanolov Apr 11, 2008 11:46 AM (in response to vladimirmanolov)Is the described behaviour supposed to be like this. If yes, am I doing something wrong by copying the tempFile in order for me to use it? This is what I do:
public void processUpload(UploadEvent event) { UploadItem uploadItem = event.getUploadItem(); String fileName = uploadItem.getFileName(); File file = uploadItem.getFile(); File repository = getRepository(); String target = repository.getAbsolutePath() + "/" + fileName; try { InputStream in = new FileInputStream(file); OutputStream out = new FileOutputStream(target); try { // Transfer bytes from in to out byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } } finally { in.close(); out.close(); } ...
-
2. Re: fileUpload keeps temp files open
sergeysmirnov Apr 11, 2008 9:10 PM (in response to vladimirmanolov)I have added task to jira to check this issue.
http://jira.jboss.com/jira/browse/RF-3055
If somebody has something to say about this topic, please do it here or there. -
3. Re: fileUpload keeps temp files open
gizola Apr 14, 2008 1:59 AM (in response to vladimirmanolov)Hi!
I use also fileupload with createTempFiles set to true.
But after file processing I can delete the file in code with File.delete(). I could also delete it manually from temp folder.
Try to delete the temp file from code after you successfully copied it to your Repository.
Regards,
Zola -
4. Re: fileUpload keeps temp files open
andrei_exadel Apr 14, 2008 9:27 AM (in response to vladimirmanolov)Hi,
It was a bug. The problem was in unclosed fileOutputSream after request parsing.
This one was added into JIRA: http://jira.jboss.com/jira/browse/RF-3063.
Fixed.
Thanks for posting about this problem. -
5. Re: fileUpload keeps temp files open
vladimirmanolov Apr 14, 2008 9:46 AM (in response to vladimirmanolov)Which version has the fix? Is it ok just to get the latest snapshot of RichFaces 1.2?
-
6. Re: fileUpload keeps temp files open
andrei_exadel Apr 14, 2008 10:00 AM (in response to vladimirmanolov)Yes. Try the latest SNAPSHOT.
-
7. Re: fileUpload keeps temp files open
vladimirmanolov Apr 15, 2008 9:10 AM (in response to vladimirmanolov)Thanks for the support. I tried the versions:
richfaces-api-3.2.1-20080415.044559-14.jar
richfaces-impl-3.2.1-20080415.044559-14.jar
richfaces-ui-3.2.1-20080415.044559-6.jar
and now it works. The temp file is closed after the upload. It can be deleted or renamed. I rename it in my upload listener so that it doesn't have a temp name but the name of the originaly uploaded file.
Thanks a lot! -
8. Re: fileUpload keeps temp files open
andrei_exadel Apr 23, 2008 5:56 AM (in response to vladimirmanolov)In addition: new issue was found.
Temporary files could not be deleted if uploading process has been stopped by user.
This issue fixed in the following snapshot of 3.2.1.