From cfd1cff1fe6d047faa50bbb29b47026b9b4a5b06 Mon Sep 17 00:00:00 2001 From: John Ross Date: Wed, 18 Sep 2013 15:55:17 -0500 Subject: 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. --- .../src/org/eclipse/osgi/baseadaptor/bundlefile/DirBundleFile.java | 7 +++++-- 1 file 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 f9b4217bf..d638158da 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 e = getEntryPaths(sb.toString(), true); + if (e != null) + entries.addAll(Collections.list(e)); + } } entries.add(sb.toString()); } -- cgit v1.2.3