[jboss-osgi-commits] JBoss-OSGI SVN: r99797 - projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle.
jboss-osgi-commits at lists.jboss.org
jboss-osgi-commits at lists.jboss.org
Fri Jan 22 04:51:37 EST 2010
Author: thomas.diesler at jboss.com
Date: 2010-01-22 04:51:36 -0500 (Fri, 22 Jan 2010)
New Revision: 99797
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/MDRUtils.java
Log:
Fix issue with getServices related to uninstalled bundles
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2010-01-22 08:32:34 UTC (rev 99796)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2010-01-22 09:51:36 UTC (rev 99797)
@@ -648,18 +648,6 @@
}
/**
- * Get the source of a class for ServiceReference.isAssignable()
- *
- * @param className the class name
- * @return the source or null if no source
- */
- public Object getSource(String className)
- {
- // [TODO] some more efficient way than using the class?
- return getBundleManager().loadClassFailsafe(this, className);
- }
-
- /**
* Change the state of the bundle
*
* @param state the new state
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/MDRUtils.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/MDRUtils.java 2010-01-22 08:32:34 UTC (rev 99796)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/MDRUtils.java 2010-01-22 09:51:36 UTC (rev 99797)
@@ -162,11 +162,11 @@
*/
private static boolean isAssignableTo(AbstractBundleState bundleState, AbstractBundleState other, String className)
{
- Object source = bundleState.getSource(className);
+ Object source = getSource(bundleState, className);
if (source == null)
throw new IllegalStateException("Cannot load '" + className + "' from: " + bundleState);
- Object otherSource = other.getSource(className);
+ Object otherSource = getSource(other, className);
if (otherSource == null)
{
log.debug("Cannot load '" + className + "' from: " + other);
@@ -187,6 +187,22 @@
}
/**
+ * Get the source of a class for ServiceReference.isAssignable()
+ *
+ * @param className the class name
+ * @return the source or null if no source
+ */
+ private static Object getSource(AbstractBundleState bundleState, String className)
+ {
+ if (bundleState.getState() == Bundle.UNINSTALLED)
+ return null;
+
+ // [TODO] some more efficient way than using the class?
+ OSGiBundleManager bundleManager = bundleState.getBundleManager();
+ return bundleManager.loadClassFailsafe(bundleState, className);
+ }
+
+ /**
* Get classloader.
*
* @param instance the instance
More information about the jboss-osgi-commits
mailing list