aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Ross2013-09-18 16:55:17 (EDT)
committerJohn Ross2013-09-19 07:50:37 (EDT)
commit07b8df36869fb14978e1c47f43a3d998952f0b3c (patch)
tree51fb7260ca14fdd2a23bb29fd47d5eb72deafa85
parentd7c4411501914be6535d4439731e04199b6bc1ed (diff)
downloadrt.equinox.framework-07b8df36869fb14978e1c47f43a3d998952f0b3c.zip
rt.equinox.framework-07b8df36869fb14978e1c47f43a3d998952f0b3c.tar.gz
rt.equinox.framework-07b8df36869fb14978e1c47f43a3d998952f0b3c.tar.bz2
Bug 417580 - Avoid NPE when recursively searching a path containing an empty directory.
The possibility of an NPE exists in DirBundleFile.getEntryPaths if all of the following apply. (1) The bundle file contains an empty directory. (2) The given path contains the empty directory. (3) Recursion was requested.
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/DirBundleFile.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/DirBundleFile.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/DirBundleFile.java
index 5807fb5..d3243b5 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/DirBundleFile.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/DirBundleFile.java
@@ -131,8 +131,11 @@ public class DirBundleFile extends BundleFile {
StringBuilder sb = new StringBuilder(dirPath).append(s);
if (BundleFile.secureAction.isDirectory(childFile)) {
sb.append("/"); //$NON-NLS-1$
- if (recurse)
- entries.addAll(Collections.list(getEntryPaths(sb.toString(), true)));
+ if (recurse) {
+ Enumeration<String> e = getEntryPaths(sb.toString(), true);
+ if (e != null)
+ entries.addAll(Collections.list(e));
+ }
}
entries.add(sb.toString());
}