FELIX-639 Just log on duplicate reference names instead of throwing
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@741611 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 0a95731..fa24dfd 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
@@ -165,7 +165,7 @@
m_componentRegistry.checkComponentName( metadata.getName() );
// validate the component metadata
- metadata.validate();
+ metadata.validate( this );
// Request creation of the component manager
ComponentManager manager;
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/ComponentMetadata.java b/scr/src/main/java/org/apache/felix/scr/impl/ComponentMetadata.java
index b837989..ecc798e 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/ComponentMetadata.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/ComponentMetadata.java
@@ -27,6 +27,7 @@
import java.util.List;
import org.osgi.service.component.ComponentException;
+import org.osgi.service.log.LogService;
/**
@@ -318,6 +319,15 @@
*/
void validate()
{
+ validate( null );
+ }
+
+
+ /**
+ * Method used to verify if the semantics of this metadata are correct
+ */
+ void validate( BundleComponentActivator bundleComponentActivator )
+ {
// nothing to do if already validated
if ( m_validated )
{
@@ -363,7 +373,11 @@
// flag duplicates
if ( !refs.add( refMeta.getName() ) )
{
- throw validationFailure( "Detected duplicate reference name: \"" + refMeta.getName() + "\"" );
+ if ( bundleComponentActivator != null )
+ {
+ bundleComponentActivator.log( LogService.LOG_WARNING, "Detected duplicate reference name: \""
+ + refMeta.getName() + "\"", this, null );
+ }
}
}
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/XmlHandler.java b/scr/src/main/java/org/apache/felix/scr/impl/XmlHandler.java
index 78213ef..1f05b43 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/XmlHandler.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/XmlHandler.java
@@ -259,9 +259,6 @@
if ( localName.equals( "component" ) )
{
this.isComponent = false;
- // When the closing tag for a component is found, the component is validated to check if
- // the implementation class has been set
- m_currentComponent.validate();
}
else if ( localName.equals( "property" ) && m_pendingProperty != null )
{