[ 
https://issues.apache.org/jira/browse/IO-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12556623#action_12556623
 ] 

Simon Kitching commented on IO-77:
----------------------------------

I'm not sure I agree with using IllegalArgumentException here.

These methods have a clear contract: the params should not be null. So there 
isn't really a justification for this method to check its params at all as 
users *should* never call it with null values.

And in fact, the majority of methods out there do *not* validate their 
parameters for null. So using IllegalArgumentException for *some* cases just 
introduces inconsistency in behaviour between methods that check their params 
(even though they shouldn't have to), and those that (quite reasonably) don't 
because they shouldn't be passed null values.

The argument that people will catch NullPointerException isn't valid; that 
exception doesn't represent an external error like FileNotFound; it represents 
an internal programming error. 



> [io] add a convenience FileUtils.move(File src, File dest)
> ----------------------------------------------------------
>
>                 Key: IO-77
>                 URL: https://issues.apache.org/jira/browse/IO-77
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 1.0
>         Environment: Operating System: other
> Platform: Other
>            Reporter: nicolas de loof
>            Priority: Minor
>             Fix For: 1.4
>
>         Attachments: IO-77.patch, patch_io.txt
>
>
> I'm using FileUtils as it partially solves the missing "move" method for File,
> that is so simple to do in unix shell.
> A full implementation in FileUtils may be great :
> static boolean FileUtils.move(File src, File dest)
> throws IOException
> {
>     boolean rename = src.renameTo(dest);
>     if (!rename)
>     {
>         copyFile(file, dest);
>         file.delete();
>     }
> }

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

Reply via email to