[ 
https://issues.apache.org/jira/browse/WICKET-6630?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Grigorov resolved WICKET-6630.
-------------------------------------
       Resolution: Fixed
         Assignee: Martin Grigorov
    Fix Version/s: 7.12.0
                   9.0.0
                   8.3.0

Thank you, [~laurenshop]!

> FileUpload.writeToTempFile() fails with commons-fileupload 1.4
> --------------------------------------------------------------
>
>                 Key: WICKET-6630
>                 URL: https://issues.apache.org/jira/browse/WICKET-6630
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 8.2.0, 8.3.0
>            Reporter: Laurens Hop
>            Assignee: Martin Grigorov
>            Priority: Major
>             Fix For: 8.3.0, 9.0.0, 7.12.0
>
>         Attachments: uploadtest-8.3-SNAPSHOT.zip, uploadtest.zip
>
>
> FileUpload.writeToTempFile() fails with commons-fileupload 1.4
> As of commons-fileupload 1.4, writing the uploaded file to a temp file with 
> {{fileUpload.writeToTempFile()}} fails with the following exception:
> {noformat}
> org.apache.commons.io.FileExistsException: Destination 
> '/var/folders/4y/_1z4yp3d7jv553km1yqc5v2r0000gn/T/null_15476330054763883202739767876103field'
>  already exists
> at org.apache.commons.io.FileUtils.moveFile(FileUtils.java:2986)
> at 
> org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:405)
> at 
> org.apache.wicket.markup.html.form.upload.FileUload.wripteTo(FileUpload.java:234)
> at 
> org.apache.wicket.markup.html.form.upload.FileUpload.writeToTempFile(FileUpload.java:254)
> {noformat}
> This only happens when the file is larger than the size threshold of 10 kB 
> (by default). In that case the uploaded content is already in a temp file and 
> will be moved to the newly created temp file. Commons-fileupload 1.3.3 used 
> {{File.rename()}} for this; in 1.4 the implementation has been changed to 
> {{FileUtils.moveFile()}}, which does not allow the destination to be present.
> To be functionally compatible with the old situation, {{FileUload.writeTo()}} 
> should delete the provided file, if present, before writing.
> See the provided test case.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to