You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Stephen Colebourne <sc...@btopenworld.com> on 2005/09/24 12:45:24 UTC

[io] ForceDelete behaviour

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?

Stephen

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [io] ForceDelete behaviour

Posted by Rahul Akolkar <ra...@gmail.com>.
On 9/24/05, Stephen Colebourne <sc...@btopenworld.com> 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org