You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by fm...@apache.org on 2010/05/05 18:59:00 UTC

svn commit: r941383 - /felix/releases/org.apache.felix.scr-1.4.0/src/main/java/org/apache/felix/scr/impl/metadata/ComponentMetadata.java

Author: fmeschbe
Date: Wed May  5 16:59:00 2010
New Revision: 941383

URL: http://svn.apache.org/viewvc?rev=941383&view=rev
Log:
FELIX-2325 Return the implementation class name from the getName method if the component name has not been explicitly set with the name attribute.

Modified:
    felix/releases/org.apache.felix.scr-1.4.0/src/main/java/org/apache/felix/scr/impl/metadata/ComponentMetadata.java

Modified: felix/releases/org.apache.felix.scr-1.4.0/src/main/java/org/apache/felix/scr/impl/metadata/ComponentMetadata.java
URL: http://svn.apache.org/viewvc/felix/releases/org.apache.felix.scr-1.4.0/src/main/java/org/apache/felix/scr/impl/metadata/ComponentMetadata.java?rev=941383&r1=941382&r2=941383&view=diff
==============================================================================
--- felix/releases/org.apache.felix.scr-1.4.0/src/main/java/org/apache/felix/scr/impl/metadata/ComponentMetadata.java (original)
+++ felix/releases/org.apache.felix.scr-1.4.0/src/main/java/org/apache/felix/scr/impl/metadata/ComponentMetadata.java Wed May  5 16:59:00 2010
@@ -381,7 +381,23 @@ public class ComponentMetadata
      */
     public String getName()
     {
-        return m_name;
+        /*
+         * Generally the default value for the name (the implementation class
+         * name) is set by the validate method if the descriptor declares a
+         * DS 1.1 or newer component. This method, though, is called before
+         * validate is called to reserve the component name. To properly
+         * support this reservation even in the absence of the name attribute
+         * this method should just return the implementation class name in
+         * this case and leave the actual version validation to the validate
+         * method. See also FELIX-2325.
+         */
+
+        if (m_name != null) {
+            return m_name;
+        }
+
+        // return the implementation class name if the name is not set
+        return getImplementationClassName();
     }