commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton" <niall.pember...@gmail.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 20:34:53 GMT
On Jan 6, 2008 9:18 AM, Stephen Colebourne <scolebourne@btopenworld.com> wrote:
> 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?

Good point - I've modified this as you suggest:

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

Niall

> Stephen

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


Mime
View raw message