You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Manuel Giesa (JIRA)" <ji...@apache.org> on 2009/09/14 18:51:57 UTC

[jira] Created: (IO-219) Add support for moving a file to an existing path if the existing file is zero bytes in size -- org.apache.commons.io.FileUtils#moveFile(File, File)

Add support for moving a file to an existing path if the existing file is zero bytes in size -- org.apache.commons.io.FileUtils#moveFile(File, File)
----------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: IO-219
                 URL: https://issues.apache.org/jira/browse/IO-219
             Project: Commons IO
          Issue Type: Improvement
          Components: Utilities
    Affects Versions: 1.4
            Reporter: Manuel Giesa
            Priority: Minor


Howdy, 

org.apache.commons.io.FileUtils#moveFile(File, File) currently throws an IOException if the destination File already exists. IMHO this is the expected behavior in cases where the destination file has is at least one byte in size. But in some cases the user might want to create a file before calling this method to be sure it was created successfully and use another filename if not. Since a generic IOException is thrown in cases where the destination file does already exist a user not able to implement counter-measures for such cases. So i suggest to add another method for this case.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (IO-219) Add support for moving a file to an existing path if the existing file is zero bytes in size -- org.apache.commons.io.FileUtils#moveFile(File, File)

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-219?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton resolved IO-219.
--------------------------------

         Assignee: Niall Pemberton
    Fix Version/s: 2.0
       Resolution: Fixed

I have added a new FileExistsException which the moveFile() and moveDirectory() methods now throw

http://svn.apache.org/viewvc?view=revision&revision=982433

> Add support for moving a file to an existing path if the existing file is zero bytes in size -- org.apache.commons.io.FileUtils#moveFile(File, File)
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: IO-219
>                 URL: https://issues.apache.org/jira/browse/IO-219
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 1.4
>            Reporter: Manuel Giesa
>            Assignee: Niall Pemberton
>            Priority: Minor
>             Fix For: 2.0
>
>
> Howdy, 
> org.apache.commons.io.FileUtils#moveFile(File, File) currently throws an IOException if the destination File already exists. IMHO this is the expected behavior in cases where the destination file has is at least one byte in size. But in some cases the user might want to create a file before calling this method to be sure it was created successfully and use another filename if not. Since a generic IOException is thrown in cases where the destination file does already exist a user not able to implement counter-measures for such cases. So i suggest to add another method for this case.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.