diff options
author | Martin Ritchie <ritchiem@apache.org> | 2009-04-11 00:15:33 +0000 |
---|---|---|
committer | Martin Ritchie <ritchiem@apache.org> | 2009-04-11 00:15:33 +0000 |
commit | b3864277dd114ed165bd67b302642dfa24edc4e8 (patch) | |
tree | b1ee50746463fc9235fab7264ab0ceaf1e985e28 | |
parent | aa92596ee62b69b6f88e62e3b545d4af6db3c4bc (diff) | |
download | qpid-python-b3864277dd114ed165bd67b302642dfa24edc4e8.tar.gz |
QPID-1803 : Fixed potential NPE in FileUtils.delete
merged from trunk r764076
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/0.5-release@764116 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/java/common/src/main/java/org/apache/qpid/util/FileUtils.java | 12 |
1 files changed, 10 insertions, 2 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 e4bfb9c664..63222b50db 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 @@ -250,9 +250,17 @@ public class FileUtils { if (recursive) { - for (File subFile : file.listFiles()) + File[] files = file.listFiles(); + + // This can occur if the file is deleted outside the JVM + if (files == null) + { + return false; + } + + for (int i = 0; i < files.length; i++) { - success = delete(subFile, true) && success; + success = delete(files[i], true) && success; } return success && file.delete(); |