[ 
https://issues.apache.org/jira/browse/FILEUPLOAD-348?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17678887#comment-17678887
 ] 

Paul Pogonyshev commented on FILEUPLOAD-348:
--------------------------------------------

According to the documentation, I guess you could simply pass 
StandardCopyOption.REPLACE_EXISTING to FileUtils.moveFile() to restore 
compatibility to pre-1.4 and also make both branches behave the same way.

> DiskFileItem.write() behavior is inconsistent if the file exists
> ----------------------------------------------------------------
>
>                 Key: FILEUPLOAD-348
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-348
>             Project: Commons FileUpload
>          Issue Type: Improvement
>    Affects Versions: 1.4
>            Reporter: Paul Pogonyshev
>            Priority: Major
>
> Usecase: writing to a temporary file created with File.createTempFile(). The 
> file returned by this method _already exists_ and is empty.
> If the contents of DiskFileItem is held in memory (i.e. is small), call to 
> DiskFileItem.write() succeeds. If it is written to the disk (i.e. is not 
> small), DiskFileItem.write() calls FileUtis.moveFile() which throws an 
> exception, as the target file already exists.
> This is inconsistent both within the same method and also with the way 1.3.3 
> used to behave (always succeed).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to