diff options
| author | Martin Ritchie <ritchiem@apache.org> | 2009-04-10 22:09:15 +0000 |
|---|---|---|
| committer | Martin Ritchie <ritchiem@apache.org> | 2009-04-10 22:09:15 +0000 |
| commit | 10cc1af6a8b5218abef0cb55f4e6be50b4f042ad (patch) | |
| tree | dad40246ec98313531ad3af44b381cf8c0c5f44f /java/common/src | |
| parent | 371e6a329dda9a6d51f6835f28e0487e95f6d6e6 (diff) | |
| download | qpid-python-10cc1af6a8b5218abef0cb55f4e6be50b4f042ad.tar.gz | |
QPID-1803 : Fixed potential NPE in FileUtils.delete
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@764076 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/common/src')
| -rw-r--r-- | java/common/src/main/java/org/apache/qpid/util/FileUtils.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/java/common/src/main/java/org/apache/qpid/util/FileUtils.java b/java/common/src/main/java/org/apache/qpid/util/FileUtils.java index e4bfb9c664..63222b50db 100644 --- a/java/common/src/main/java/org/apache/qpid/util/FileUtils.java +++ b/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(); |
