[
https://issues.apache.org/jira/browse/FILEUPLOAD-348?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17678886#comment-17678886
]
Paul Pogonyshev commented on FILEUPLOAD-348:
--------------------------------------------
Either I missed notification or it was never sent for whatever reason.
In any case, as far as I see, nothing relevant has been changed in
DiskFileItem.write(). It would still fail if not in memory _and_ target file
exists. As I mentioned, this is bad, because it is incompatible with previous
versions and also sort-of-arbitrarily fails depending on whether the item is
small (is in memory) or not.
> 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)