]> source.dussan.org Git - sonarqube.git/commitdiff
Fix key of components registered in picocontainer
authorsimonbrandhof <simon.brandhof@gmail.com>
Sun, 19 Jun 2011 23:49:24 +0000 (01:49 +0200)
committersimonbrandhof <simon.brandhof@gmail.com>
Sun, 19 Jun 2011 23:49:24 +0000 (01:49 +0200)
sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java

index a3bd938116f566e29321b8a83d2ad32988d2e6e2..b937d6d30c02a0148d0e20e0a4c457a3b28f7234 100644 (file)
@@ -131,7 +131,7 @@ public class ServerPluginRepository implements PluginRepository {
 
   void installExtension(MutablePicoContainer container, Object extension) {
     if (isType(extension, ServerExtension.class)) {
-      container.as(Characteristics.CACHE).addComponent(extension);
+      container.as(Characteristics.CACHE).addComponent(getExtensionKey(extension), extension);
     }
   }
 
@@ -139,4 +139,11 @@ public class ServerPluginRepository implements PluginRepository {
     Class clazz = (extension instanceof Class ? (Class) extension : extension.getClass());
     return extensionClass.isAssignableFrom(clazz);
   }
+
+  static Object getExtensionKey(Object component) {
+    if (component instanceof Class) {
+      return component;
+    }
+    return component.getClass().getCanonicalName() + "-" + component.toString();
+  }
 }