String message = "The component name '" + name + "' has already been registered";
if ( existingRegistration != null )
{
Bundle cBundle = existingRegistration.getActivator().getBundleContext().getBundle();
ComponentMetadata cMeta = existingRegistration.getComponentMetadata();
StringBuffer buf = new StringBuffer( message );
buf.append( " by Bundle " ).append( cBundle.getBundleId() );
if ( cBundle.getSymbolicName() != null )
{
buf.append( " (" ).append( cBundle.getSymbolicName() ).append( ")" );
}
buf.append( " as Component of Class " ).append( cMeta.getImplementationClassName() );
message = buf.toString();
}
throw new ComponentException( message );
}