If the a bundle is already stale, treat further attempts to close
it as no-ops. (FELIX-3160)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1209843 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/BundleImpl.java b/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
index 12a1b63..6dda703 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
@@ -132,12 +132,15 @@
 // for last case.
     synchronized void closeAndDelete() throws Exception
     {
-        // Mark the bundle as stale, since it is being deleted.
-        m_stale = true;
-        // Close all revisions.
-        closeRevisions();
-        // Delete bundle archive, which will close revisions.
-        m_archive.closeAndDelete();
+        if (!m_stale)
+        {
+            // Mark the bundle as stale, since it is being deleted.
+            m_stale = true;
+            // Close all revisions.
+            closeRevisions();
+            // Delete bundle archive, which will close revisions.
+            m_archive.closeAndDelete();
+        }
     }
 
 // Called from BundleImpl.close(), BundleImpl.closeAndDelete(), and BundleImpl.refresh()