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 | 1f48e2409ae3187dd31d093e68d3f6fa8617a0d1 (patch) | |
| tree | 0eeca272ca2e58af2dca151e92e162e329fd6d1d /qpid/java | |
| parent | e9d3bc28203ac64a1b63e29c823731f0c598d764 (diff) | |
| download | qpid-python-1f48e2409ae3187dd31d093e68d3f6fa8617a0d1.tar.gz | |
QPID-1803 : Fixed potential NPE in FileUtils.delete
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@764076 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
| -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(); |
