commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 19369] New: - [fileupload] write() method can be invoked only once.
Date Sun, 27 Apr 2003 17:58:20 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19369>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19369

[fileupload] write() method can be invoked only once.

           Summary: [fileupload] write() method can be invoked only once.
           Product: Commons
           Version: 1.0 Beta 1
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: File Upload
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: thierry.deleeuw@advalvas.be


the way "write()" is implemented looks a bit dangerous to me. File.renameTo 
currently seems to not update the "internal" filename. So your original file 
is "/tmp/upload_00000000.tmp", after the renameTo("/usr/test.jar") the File 
object still contains "/tmp/upload_00000000.tmp" (which I'm not sure it is 
valid, I would expect to "follow" the file. But this is Sun implementation).

    if (storeLocation != null && storeLocation.exists()) {
        storeLocation.delete();
    }

This means that if Sun decide to change their implementation and the way 
RenameTo works (to "follow" the underlying file), you will actually delete the 
file that the user tried to save. 
It also means that you can call (with the current Sun implementation) write() 
method only once (the source file "disapears" after the first rename). If Sun 
changes the implementation, you will be able to call it more than once but then 
you will only have one copy of the file (where I would expect to have multiple 
copies).

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message