FELIX-923 Provide more information in case of component name duplication

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@741566 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java b/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
index 130f348..0fea12d 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
@@ -138,7 +138,24 @@
     {
         if ( m_componentsByName.containsKey( name ) )
         {
-            throw new ComponentException( "The component name '" + name + "' has already been registered." );
+            String message = "The component name '" + name + "' has already been registered";
+
+            Object co = m_componentsByName.get( name );
+            if ( co instanceof ComponentManager )
+            {
+                ComponentManager c = ( ComponentManager ) co;
+                StringBuffer buf = new StringBuffer( message );
+                buf.append( " by Bundle " ).append( c.getBundle().getBundleId() );
+                if ( c.getBundle().getSymbolicName() != null )
+                {
+                    buf.append( " (" ).append( c.getBundle().getSymbolicName() ).append( ")" );
+                }
+                buf.append( " as Component " ).append( c.getId() );
+                buf.append( " of Class " ).append( c.getClassName() );
+                message = buf.toString();
+            }
+
+            throw new ComponentException( message );
         }
 
         // reserve the name