You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Stefan Scheidewig <th...@eknet.org> on 2014/03/03 08:21:28 UTC

Proposal for fixing the NamespaceMapper Binding

Hello,

I tried to build the Apache Sling project but the build always fails 
within the "Apache Sling Launchpad Testing" project. The reason for that 
failure are two tests regarding the dynamic namespace mapping 
NamespaceMappingTest#testNamespaceFromNamespaceMapper and 
NamespaceMappingTest#testNamespaceFromNamespaceMapperWithImpersonation. 
A closer look to the failing code it reveals that within the class 
org.apache.sling.jcr.jackrabbit.server.impl.SlingServerRepositoryManager 
the bind method for the namespace service references is accessing the 
ComponentContext set by the activate method but unfortunately that is 
incorrect because the Declarative Services Specification Version 1.1 - 
section 112.5.6 states that the binding happens before the activation. 
So the attempt to bind the TestNamespaceMapper Service to the 
SlingServerRepositoryManager always results in a NPE.

After I changed the service binding slightly the TestNamespaceMapper can 
be called. See the attached patch.

Regards,
Stefan

Re: Proposal for fixing the NamespaceMapper Binding

Posted by Stefan Scheidewig <th...@eknet.org>.
Hi Felix,

done by creating SLING-3427. I wonder why that build only fails for my 
machine. On another machine this build only fails if i only build the 
"Launchpad Testing" project but not the complete project. Maybe there is 
an error or at least some kind of side effect within the build process?

Regards,
Stefan

Am 03.03.2014 09:49, schrieb Felix Meschberger:
> Hi Stefan
> 
> Thanks for tracking this down. May I ask you to report an issue at
> https://issues.apache.org/jira/browse/SLING and attach the patch to
> that issue ?
> 
> Thanks
> Felix
> 
> Am 03.03.2014 um 08:21 schrieb Stefan Scheidewig <th...@eknet.org>:
> 
>> Hello,
>> 
>> I tried to build the Apache Sling project but the build always fails 
>> within the "Apache Sling Launchpad Testing" project. The reason for 
>> that failure are two tests regarding the dynamic namespace mapping 
>> NamespaceMappingTest#testNamespaceFromNamespaceMapper and 
>>  
>> amespaceMappingTest#testNamespaceFromNamespaceMapperWithImpersonation. 
>> A closer look to the failing code it reveals that within the class 
>>  
>>  
>> g.apache.sling.jcr.jackrabbit.server.impl.SlingServerRepositoryManager 
>> the bind method for the namespace service references is accessing the 
>> ComponentContext set by the activate method but unfortunately that is 
>> incorrect because the Declarative Services Specification Version 1.1 - 
>> section 112.5.6 states that the binding happens before the activation. 
>> So the attempt to bind the TestNamespaceMapper Service to the 
>> SlingServerRepositoryManager always results in a NPE.
>> 
>> After I changed the service binding slightly the TestNamespaceMapper 
>> can be called. See the attached patch.
>> 
>> Regards,
>> Stefan
>> <namespacemapper_binding_fix.patch>

Re: Proposal for fixing the NamespaceMapper Binding

Posted by Felix Meschberger <fm...@adobe.com>.
Hi Stefan

Thanks for tracking this down. May I ask you to report an issue at https://issues.apache.org/jira/browse/SLING and attach the patch to that issue ?

Thanks
Felix

Am 03.03.2014 um 08:21 schrieb Stefan Scheidewig <th...@eknet.org>:

> Hello,
> 
> I tried to build the Apache Sling project but the build always fails within the "Apache Sling Launchpad Testing" project. The reason for that failure are two tests regarding the dynamic namespace mapping NamespaceMappingTest#testNamespaceFromNamespaceMapper and NamespaceMappingTest#testNamespaceFromNamespaceMapperWithImpersonation. A closer look to the failing code it reveals that within the class org.apache.sling.jcr.jackrabbit.server.impl.SlingServerRepositoryManager the bind method for the namespace service references is accessing the ComponentContext set by the activate method but unfortunately that is incorrect because the Declarative Services Specification Version 1.1 - section 112.5.6 states that the binding happens before the activation. So the attempt to bind the TestNamespaceMapper Service to the SlingServerRepositoryManager always results in a NPE.
> 
> After I changed the service binding slightly the TestNamespaceMapper can be called. See the attached patch.
> 
> Regards,
> Stefan
> <namespacemapper_binding_fix.patch>