summaryrefslogtreecommitdiff
path: root/qpid/java/common/src
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2009-03-06 15:46:14 +0000
committerMartin Ritchie <ritchiem@apache.org>2009-03-06 15:46:14 +0000
commitc2aa1bcbbe94b721b2b34530c910faea15b1c307 (patch)
tree016b8dabcd96252ae0e89c94cccc196e9a25b4b2 /qpid/java/common/src
parenta7bb158ab88b8d23337444cd77015d8e602d3d30 (diff)
downloadqpid-python-c2aa1bcbbe94b721b2b34530c910faea15b1c307.tar.gz
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.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@750946 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/common/src')
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/util/FileUtils.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/util/FileUtils.java b/qpid/java/common/src/main/java/org/apache/qpid/util/FileUtils.java
index 3d43b9d511..585657c8bb 100644
--- a/qpid/java/common/src/main/java/org/apache/qpid/util/FileUtils.java
+++ b/qpid/java/common/src/main/java/org/apache/qpid/util/FileUtils.java
@@ -246,18 +246,19 @@ public class FileUtils
{
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();