commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Colebourne <scolebou...@btopenworld.com>
Subject Re: svn commit: r609253 - in /commons/proper/io/trunk: RELEASE-NOTES.txt src/java/org/apache/commons/io/FileUtils.java src/test/org/apache/commons/io/FileUtilsTestCase.java
Date Sun, 06 Jan 2008 09:18:06 GMT
niallp@apache.org wrote:
> +    public static boolean deleteQuietly(File file) {
> +        if (file == null) {
> +            return false;
> +        }
> +        try {
> +            if (file.isDirectory()) {
> +                cleanDirectory(file);
> +            }
> +        } catch (Throwable t) {
> +        }
> +
> +        try {
> +            return file.delete();
> +        } catch (Throwable t) {
> +            return false;
> +        }

I think I would prefer catch(Exception) rather than catch(Throwable). 
Hiding an OutOfMemoryError (and similar) is generally a Bad Idea. Is 
there a specific use case for catching Throwable?

Stephen

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


Mime
View raw message