aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Ross2013-09-18 16:55:17 (EDT)
committerJohn Ross2013-09-18 16:55:17 (EDT)
commitcfd1cff1fe6d047faa50bbb29b47026b9b4a5b06 (patch)
treeea1f4d9454a03762dfb539888259526a2c6dac06
parent67b504f954b4b5be739c8fe400c11f54120cdb5f (diff)
downloadrt.equinox.framework-cfd1cff1fe6d047faa50bbb29b47026b9b4a5b06.zip
rt.equinox.framework-cfd1cff1fe6d047faa50bbb29b47026b9b4a5b06.tar.gz
rt.equinox.framework-cfd1cff1fe6d047faa50bbb29b47026b9b4a5b06.tar.bz2
Bug 416715 - 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/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/bundlefile/DirBundleFile.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/bundlefile/DirBundleFile.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/bundlefile/DirBundleFile.java
index f9b4217..d638158 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/bundlefile/DirBundleFile.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/bundlefile/DirBundleFile.java
@@ -96,8 +96,11 @@ public class DirBundleFile extends BundleFile {
StringBuffer sb = new StringBuffer(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());
}