FELIX-3698 obtain ComponentHolder directly from ComponentRegistry
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1393715 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java b/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java
index fc1257f..9f1d6d0 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java
@@ -461,19 +461,10 @@
return ( ComponentHolder[] ) m_managers.toArray( new ComponentHolder[m_managers.size()] );
}
- if ( m_componentRegistry.getComponentHolder( m_context.getBundle(), name ) != null )
+ ComponentHolder componentHolder = m_componentRegistry.getComponentHolder( m_context.getBundle(), name );
+ if (componentHolder != null)
{
- // otherwise just find it
- Iterator it = m_managers.iterator();
- while ( it.hasNext() )
- {
- ComponentHolder cm = ( ComponentHolder ) it.next();
- if ( name.equals( cm.getComponentMetadata().getName() ) )
- {
- return new ComponentHolder[]
- { cm };
- }
- }
+ return new ComponentHolder[] { componentHolder };
}
// if the component is not known