[
https://issues.apache.org/jira/browse/SLING-13139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mike Mansell updated SLING-13139:
---------------------------------
Description:
During the registration and activation of a service with the OsgiContext, such
as
registerInjectActivateService, an incorrect component.name is registered if the
component defines it's own name.
Within MapMergeUtil.propertiesMergeWithOsgiMetadata, the property
component.name
is automatically set. The current implementation uses the class name. However,
the OSGi specification (Compendium 8.1, section 112.6) indicates that the
property should equal the component name. The component name is defined in
Section 112.4.4, as the name property in the component metadata, and if not
present, to default to the class name.
Therefore, the line:
mergedProperties.put(ComponentConstants.COMPONENT_NAME, targetClass.getName());
should be
mergedProperties.put(ComponentConstants.COMPONENT_NAME, metadata == null ?
targetClass.getName() : metadata.getName());
was:
During the registration and activation of a service with the OsgiContext, such
as
registerInjectActivateService, an incorrect component.name is registered if the
component defines it's own name.
Within MapMergeUtil.propertiesMergeWithOsgiMetadata, the property
component.name
is automatically set. The current implementation uses the class name. However,
the OSGi specification (Compendium 8.1, section 112.6) indicates that the
property should equal the component name. The component name is defined in
Section 112.4.4, as the name property in the component metadata, and if not
present, to default to the class name.
Therefore, the line:
mergedProperties.put(ComponentConstants.COMPONENT_NAME, targetClass.getName());
should be
mergedProperties.put(ComponentConstants.COMPONENT_NAME, metadata.getName());
> component.name property not equaling the component name.
> --------------------------------------------------------
>
> Key: SLING-13139
> URL: https://issues.apache.org/jira/browse/SLING-13139
> Project: Sling
> Issue Type: Bug
> Components: Testing
> Affects Versions: Testing OSGi Mock 3.5.6
> Reporter: Mike Mansell
> Priority: Major
>
> During the registration and activation of a service with the OsgiContext,
> such as
> registerInjectActivateService, an incorrect component.name is registered if
> the component defines it's own name.
>
> Within MapMergeUtil.propertiesMergeWithOsgiMetadata, the property
> component.name
> is automatically set. The current implementation uses the class name.
> However, the OSGi specification (Compendium 8.1, section 112.6) indicates
> that the property should equal the component name. The component name is
> defined in Section 112.4.4, as the name property in the component metadata,
> and if not present, to default to the class name.
> Therefore, the line:
> mergedProperties.put(ComponentConstants.COMPONENT_NAME,
> targetClass.getName());
> should be
> mergedProperties.put(ComponentConstants.COMPONENT_NAME, metadata == null ?
> targetClass.getName() : metadata.getName());
--
This message was sent by Atlassian Jira
(v8.20.10#820010)