You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Paul Pogonyshev (Jira)" <ji...@apache.org> on 2022/08/22 08:23:00 UTC

[jira] [Created] (FILEUPLOAD-348) DiskFileItem.write() behavior is inconsistent if the file exists

Paul Pogonyshev created FILEUPLOAD-348:
------------------------------------------

             Summary: 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


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)