On 9/24/05, Stephen Colebourne <[EMAIL PROTECTED]> wrote:
> FileUtils.forceDelete(File) currently throws an IOException if the file
> does not exist.
>
> This seems like pretty crazy behaviour, so should we change it?
>
> Theoretically, its a semantically incompatible change, but would it
> really cause anyone issues? Is it more of a bug?
<snip/>

As a user, if I'm aggressive enough to call forceDelete(File) I would
expect notification if the file did not exist in the first place
(might indicate other issues).

I'd want to differentiate:
(1) Deletion success
(2) Deletion failure
(3) Non-existing File

which I would do like so:

<incomplete-code-snippet>
try {
  FileUtils.forceDelete(fileFooBar);
} catch (FileNotFoundException fnfe) {
  // (3) Yell at developer
} catch (IOException ioe) {
  // (2) Yell at Filesystem
}
// (1) Move on
</incomplete-code-snippet>

-Rahul

>
> Stephen
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to