Fixed a bug in exported package handling that was not searching uninstalled
bundles and another that was failing to return null if no exported package
was found.


git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@418069 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
index 5770f97..098afb7 100644
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -2021,6 +2021,17 @@
             }
         }
 
+        synchronized (m_uninstalledBundlesLock_Priority3)
+        {
+            for (int i = 0; i < m_uninstalledBundles.length; i++)
+            {
+                if (m_uninstalledBundles[i].getInfo().getBundleId() == id)
+                {
+                    return m_uninstalledBundles[i];
+                }
+            }
+        }
+
         return null;
     }
 
@@ -2555,7 +2566,7 @@
         ExportedPackage[] pkgs = getExportedPackages(name);
         // There can be multiple versions of the same package exported,
         // so we will just return the first one.
-        return (pkgs != null) ? pkgs[0] : null;
+        return ((pkgs != null) && (pkgs.length != 0)) ? pkgs[0] : null;
     }
 
     /**