Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2007-09-06 15:17:28 +0000
committerThomas Watson2007-09-06 15:17:28 +0000
commit590581d388f746c7939006793d30053bc1a91259 (patch)
tree1597267dc7061cfafc67ec98b95c30deada61f63
parent14848e14b6ed7274a45a950b7f0ff13806f1c942 (diff)
downloadrt.equinox.framework-R3_2_1_criticalFixes.tar.gz
rt.equinox.framework-R3_2_1_criticalFixes.tar.xz
rt.equinox.framework-R3_2_1_criticalFixes.zip
Bug 201489 [osgi R5] multiple versions of a fragment should not attach to the same hostR3_2_1_criticalFixes
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java8
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java20
2 files changed, 26 insertions, 2 deletions
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java
index 7e94894f6..a065e0fb1 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java
@@ -324,6 +324,14 @@ public class ResolverBundle extends VersionSupplier {
fragment.setNewFragmentExports(true);
initFragments();
+ // need to make sure there is not already another version of this fragment
+ // already attached to this host
+ for (Iterator iFragments = fragments.iterator(); iFragments.hasNext();) {
+ ResolverBundle existingFragment = (ResolverBundle) iFragments.next();
+ String bsn = existingFragment.getName();
+ if (bsn != null && bsn.equals(fragment.getName()))
+ return new ResolverExport[0];
+ }
if (fragments.contains(fragment))
return new ResolverExport[0];
fragments.add(fragment);
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java
index fa7cbc572..77e6d0744 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java
@@ -287,7 +287,22 @@ public class ResolverImpl implements org.eclipse.osgi.service.resolver.Resolver
}
// Attach fragment to its host
- private void attachFragment(ResolverBundle bundle, ArrayList rejectedSingletons) {
+ private void attachFragment(ResolverBundle bundle, ArrayList rejectedSingletons, ArrayList processedFragments) {
+ if (processedFragments.contains(bundle.getName()))
+ return;
+ processedFragments.add(bundle.getName());
+ // we want to attach multiple versions of the same fragment
+ // from highest version to lowest to give the higher versions first pick
+ // of the available host bundles.
+ Object[] fragments = resolverBundles.get(bundle.getName());
+ for (int i = 0; i < fragments.length; i++) {
+ ResolverBundle fragment = (ResolverBundle) fragments[i];
+ if (!fragment.isResolved())
+ attachFragment0(fragment, rejectedSingletons);
+ }
+ }
+
+ private void attachFragment0(ResolverBundle bundle, ArrayList rejectedSingletons) {
if (!bundle.isFragment() || !bundle.isResolvable() || rejectedSingletons.contains(bundle.getBundle()))
return;
// no need to select singletons now; it will be done when we select the rest of the singleton bundles (bug 152042)
@@ -403,8 +418,9 @@ public class ResolverImpl implements org.eclipse.osgi.service.resolver.Resolver
}
// First attach all fragments to the matching hosts
+ ArrayList processedFragments = new ArrayList(bundles.length);
for (int i = 0; i < bundles.length; i++)
- attachFragment(bundles[i], rejectedSingletons);
+ attachFragment(bundles[i], rejectedSingletons, processedFragments);
// add initial grouping constraints after fragments have been attached
for (int i = 0; i < bundles.length; i++)

Back to the top