Author: ritchiem Date: Fri Mar 6 15:46:14 2009 New Revision: 750946 URL: http://svn.apache.org/viewvc?rev=750946&view=rev Log: FileUtils : Was not correctly handling the case where a File object became null, it would previously have thrown a NPE which was erroneously caught this and declared the delete to have failed. If there is nothing to delete (signified by the Null File object) then the delete should pass.
Modified: qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/util/FileUtils.java Modified: qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/util/FileUtils.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/util/FileUtils.java?rev=750946&r1=750945&r2=750946&view=diff ============================================================================== --- qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/util/FileUtils.java (original) +++ qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/util/FileUtils.java Fri Mar 6 15:46:14 2009 @@ -246,18 +246,19 @@ { boolean success = true; + // If we have nothing to delete then it must be ok to say it was deleted. + if (file == null) + { + return true; + } + if (file.isDirectory()) { if (recursive) { - try{ - for (File subFile : file.listFiles()) - { - success = delete(subFile, true) & success ; - } - }catch (NullPointerException npe) + for (File subFile : file.listFiles()) { - success = false; + success = delete(subFile, true) & success ; } return success && file.delete(); --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org