Fixed a bug in service registration where when verifying the class of the
service object a null pointer exception could result. Fixed a spec compliance
issue where a framework event should be fired instead of throwing an exception
when stop() throws an exception during uninstall().
git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@418959 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 e772e4c..9308e1a 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
@@ -1733,8 +1733,6 @@
AccessController.checkPermission(m_adminPerm);
}
- BundleException rethrow = null;
-
BundleInfo info = bundle.getInfo();
if (info.getState() == Bundle.UNINSTALLED)
{
@@ -1750,7 +1748,7 @@
}
catch (BundleException ex)
{
- rethrow = ex;
+ fireFrameworkEvent(FrameworkEvent.ERROR, bundle, ex);
}
// Remove the bundle from the installed map.
@@ -1785,11 +1783,6 @@
// Fire bundle event.
fireBundleEvent(BundleEvent.UNINSTALLED, bundle);
-
- if (rethrow != null)
- {
- throw rethrow;
- }
}
//
@@ -2309,6 +2302,8 @@
**/
private static Class loadClassUsingClass(Class clazz, String name)
{
+ Class loadedClass = null;
+
while (clazz != null)
{
// Get the class loader of the current class object.
@@ -2330,10 +2325,10 @@
Class[] ifcs = clazz.getInterfaces();
for (int i = 0; i < ifcs.length; i++)
{
- clazz = loadClassUsingClass(ifcs[i], name);
- if (clazz != null)
+ loadedClass = loadClassUsingClass(ifcs[i], name);
+ if (loadedClass != null)
{
- return clazz;
+ return loadedClass;
}
}