[jboss-cvs] JBossAS SVN: r97309 - projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Dec 2 12:04:08 EST 2009


Author: alesj
Date: 2009-12-02 12:04:08 -0500 (Wed, 02 Dec 2009)
New Revision: 97309

Modified:
   projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/MDRUtils.java
Log:
Get classloader info.

Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/MDRUtils.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/MDRUtils.java	2009-12-02 16:53:07 UTC (rev 97308)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/MDRUtils.java	2009-12-02 17:04:08 UTC (rev 97309)
@@ -172,8 +172,8 @@
       boolean equals = source.equals(otherSource);
       if (equals == false)
       {
-         ClassLoader otherLoader = otherSource.getClass().getClassLoader();
-         ClassLoader sourceLoader = source.getClass().getClassLoader();
+         ClassLoader otherLoader = getClassLoader(otherSource);
+         ClassLoader sourceLoader = getClassLoader(source);
          StringBuffer buffer = new StringBuffer("Cannot assign '" + className + "' comming from different exporters");
          buffer.append("\n  service: ").append(sourceLoader);
          buffer.append("\n  request: ").append(otherLoader);
@@ -183,6 +183,17 @@
    }
 
    /**
+    * Get classloader.
+    *
+    * @param instance the instance
+    * @return instance's classloader
+    */
+   private static ClassLoader getClassLoader(Object instance)
+   {
+      return (instance instanceof Class) ? Class.class.cast(instance).getClassLoader() : instance.getClass().getClassLoader();
+   }
+
+   /**
     * Match class.
     *
     * @param context the context




More information about the jboss-cvs-commits mailing list