felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r741566 - /felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
Date Fri, 06 Feb 2009 13:51:11 GMT
Author: fmeschbe
Date: Fri Feb  6 13:51:10 2009
New Revision: 741566

URL: http://svn.apache.org/viewvc?rev=741566&view=rev
Log:
FELIX-923 Provide more information in case of component name duplication

Modified:
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java?rev=741566&r1=741565&r2=741566&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java Fri Feb
 6 13:51:10 2009
@@ -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



Mime
View raw message