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 2008/01/06 10:18:06 UTC
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
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
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
Posted by Niall Pemberton <ni...@gmail.com>.
On Jan 6, 2008 9:18 AM, Stephen Colebourne <sc...@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