Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Lippert2014-08-21 15:07:08 +0000
committerMartin Lippert2014-08-21 15:10:07 +0000
commita8bbc127735427ac4b88762da35d2a320f740a34 (patch)
treebba8ccb89577fceaa61b8ce096078806b2b254fd
parent419ffea2c2b2ca004b1466f627b40e31c787ea2e (diff)
downloadrt.equinox.bundles-a8bbc127735427ac4b88762da35d2a320f740a34.tar.gz
rt.equinox.bundles-a8bbc127735427ac4b88762da35d2a320f740a34.tar.xz
rt.equinox.bundles-a8bbc127735427ac4b88762da35d2a320f740a34.zip
Bug 442276: checking bundle state now before taking it into account for the supplementer mechanism
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingHook.java21
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingLoaderDelegateHook.java26
2 files changed, 28 insertions, 19 deletions
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingHook.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingHook.java
index 8318e16ec..dda483978 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingHook.java
+++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingHook.java
@@ -1,14 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 IBM Corporation and others.
+ * Copyright (c) 2006, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
- * David Knibb initial implementation
- * Matthew Webster Eclipse 3.2 changes
- * Martin Lippert supplementing mechanism reworked
+ * David Knibb initial implementation
+ * Matthew Webster Eclipse 3.2 changes
+ * Martin Lippert supplementing mechanism reworked
*******************************************************************************/
package org.eclipse.equinox.weaving.hooks;
@@ -127,13 +127,18 @@ public class WeavingHook extends AbstractWeavingHook {
context.addBundleListener(new SupplementBundleListener(
supplementerRegistry));
- // final re-build supplementer final registry state for final installed bundles
+ // re-build supplementer registry state for installed bundles
final Bundle[] installedBundles = context.getBundles();
for (int i = 0; i < installedBundles.length; i++) {
- supplementerRegistry.addSupplementer(installedBundles[i], false);
+ if (installedBundles[i].getState() != Bundle.UNINSTALLED) {
+ supplementerRegistry
+ .addSupplementer(installedBundles[i], false);
+ }
}
for (int i = 0; i < installedBundles.length; i++) {
- supplementerRegistry.addSupplementedBundle(installedBundles[i]);
+ if (installedBundles[i].getState() != Bundle.UNINSTALLED) {
+ supplementerRegistry.addSupplementedBundle(installedBundles[i]);
+ }
}
if (Debug.DEBUG_GENERAL)
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingLoaderDelegateHook.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingLoaderDelegateHook.java
index bd7ddcb04..e20643cac 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingLoaderDelegateHook.java
+++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingLoaderDelegateHook.java
@@ -1,10 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Martin Lippert and others.
+ * Copyright (c) 2008, 2014 Martin Lippert and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Martin Lippert initial implementation
* Martin Lippert fragment handling fixed
@@ -22,12 +22,13 @@ import org.eclipse.equinox.service.weaving.ISupplementerRegistry;
import org.eclipse.equinox.service.weaving.Supplementer;
import org.eclipse.osgi.internal.hookregistry.ClassLoaderHook;
import org.eclipse.osgi.internal.loader.ModuleClassLoader;
+import org.osgi.framework.Bundle;
/**
* This class implements the delegate hook for the class loader to allow
* supplemented bundles find types and resources from theirs supplementer
* bundles
- *
+ *
* This works together with the supplementer registry to handle the
* supplementing mechanism. The supplementer registry controls which bundle is
* supplemented by which other bundle. This hook implementation uses this
@@ -65,7 +66,7 @@ public class WeavingLoaderDelegateHook extends ClassLoaderHook {
/**
* Create the hook instance for broaden the visibility according to the
* supplementing mechansism.
- *
+ *
* @param supplementerRegistry The supplementer registry to be used by this
* hook for information retrieval which bundles are supplemented
* by which other bundles (needs to not be null)
@@ -76,7 +77,7 @@ public class WeavingLoaderDelegateHook extends ClassLoaderHook {
}
/**
- *
+ *
* @see org.eclipse.osgi.internal.hookregistry.ClassLoaderHook#postFindClass(java.lang.String,
* org.eclipse.osgi.internal.loader.ModuleClassLoader)
*/
@@ -97,10 +98,13 @@ public class WeavingLoaderDelegateHook extends ClassLoaderHook {
if (supplementers != null) {
for (int i = 0; i < supplementers.length; i++) {
try {
- final Class<?> clazz = supplementers[i]
- .getSupplementerHost().loadClass(name);
- if (clazz != null) {
- return clazz;
+ final Bundle bundle = supplementers[i]
+ .getSupplementerHost();
+ if (bundle.getState() != Bundle.UNINSTALLED) {
+ final Class<?> clazz = bundle.loadClass(name);
+ if (clazz != null) {
+ return clazz;
+ }
}
} catch (final ClassNotFoundException e) {
}
@@ -114,7 +118,7 @@ public class WeavingLoaderDelegateHook extends ClassLoaderHook {
}
/**
- *
+ *
* @see org.eclipse.osgi.internal.hookregistry.ClassLoaderHook#postFindResource(java.lang.String,
* org.eclipse.osgi.internal.loader.ModuleClassLoader)
*/
@@ -153,7 +157,7 @@ public class WeavingLoaderDelegateHook extends ClassLoaderHook {
}
/**
- *
+ *
* @see org.eclipse.osgi.internal.hookregistry.ClassLoaderHook#postFindResources(java.lang.String,
* org.eclipse.osgi.internal.loader.ModuleClassLoader)
*/

Back to the top