Modify bundle uninstall state transitions to transition through INSTALLED
on the way to UNINSTALLED. (FELIX-1527)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@807760 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/Felix.java b/framework/src/main/java/org/apache/felix/framework/Felix.java
index 524f79b..371356c 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -2218,6 +2218,12 @@
                     Logger.LOG_ERROR, "Unable to remove bundle from installed map!");
             }
 
+            setBundleStateAndNotify(bundle, Bundle.INSTALLED);
+
+            // Unfortunately, fire UNRESOLVED event while holding the lock,
+            // since we still need to change the bundle state.
+            fireBundleEvent(BundleEvent.UNRESOLVED, bundle);
+
             // Set state to uninstalled.
             setBundleStateAndNotify(bundle, Bundle.UNINSTALLED);
             bundle.setLastModified(System.currentTimeMillis());
@@ -2228,9 +2234,6 @@
             releaseBundleLock(bundle);
         }
 
-        // Fire UNRESOLVED event without holding the lock.
-        fireBundleEvent(BundleEvent.UNRESOLVED, bundle);
-
         // Fire UNINSTALLED event without holding the lock.
         fireBundleEvent(BundleEvent.UNINSTALLED, bundle);