No longer need impl-specific API to determine removal pending. (FELIX-2950)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1165664 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java b/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
index 84964d3..7e184cc 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
@@ -310,16 +310,6 @@
return m_protectionDomain;
}
- // TODO: FRAGMENT RESOLVER - Technically, this is only necessary for fragments.
- // When we refactoring for the new R4.3 framework API, we'll have to see
- // if this is still necessary, since the new BundleWirings API will give
- // us another way to detect it.
- public boolean isRemovalPending()
- {
- return (m_bundle.getState() == Bundle.UNINSTALLED)
- || (this != m_bundle.adapt(BundleRevision.class));
- }
-
//
// Content access methods.
//
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java b/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
index 76e8e18..4e4ccda 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
@@ -741,9 +741,13 @@
for (BundleRequirement hostReq : versionEntry.getValue())
{
// Select the highest version of the fragment that
- // is not removal pending.
- if (isFirst
- && !((BundleRevisionImpl) hostReq.getRevision()).isRemovalPending())
+ // is not removal pending. If the fragment revision
+ // is removal pending, then its current revision will
+ // be null or won't match the existing revision.
+ BundleRevision currentFragmentRevision =
+ hostReq.getRevision().getBundle()
+ .adapt(BundleRevision.class);
+ if (isFirst && (currentFragmentRevision == hostReq.getRevision()))
{
selectedFragments.add(hostReq.getRevision());
isFirst = false;