[ 
https://issues.apache.org/jira/browse/SLING-3757?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Carsten Ziegeler resolved SLING-3757.
-------------------------------------

    Resolution: Fixed

Actually using the ServiceUtil method was wrong as the map provided to the 
activate method never contains the service id - the junit tests didn't catch 
this as they were providing maps with the service id set.
In addition, the update method on the service map was wrongly specified, so 
changes to the configuration of a service where ignored as well
All fixed now in rev 1609569

> cannot add more than 1 service user with the OSGI console
> ---------------------------------------------------------
>
>                 Key: SLING-3757
>                 URL: https://issues.apache.org/jira/browse/SLING-3757
>             Project: Sling
>          Issue Type: Bug
>    Affects Versions: Service User Mapper 1.0.0
>            Reporter: Jean-Christophe Kautzmann
>            Assignee: Carsten Ziegeler
>             Fix For: Service User Mapper 1.0.4
>
>
> To reproduce:
> 1. Open the OSGI console -> configuration -> Apache Sling Service User Mapper 
> Service Amendment
> 2. add 2 configs and save
> In the error.log:
> {code}
> 10.07.2014 16:33:29.074 *ERROR* [CM Event Dispatcher (Fire 
> ConfigurationEvent: 
> pid=org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended.28a5ee37-c86b-40d7-892f-44a5b1b0a72c)]
>  org.apache.sling.serviceusermapper 
> [org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl(17)] The 
> bindAmendment method has thrown an exception (java.lang.NullPointerException)
> java.lang.NullPointerException: null
>      at 
> org.apache.sling.commons.osgi.ServiceUtil$ComparableImplementation.compareTo(ServiceUtil.java:70)
>      at 
> org.apache.sling.serviceusermapping.impl.MappingConfigAmendment.compareTo(MappingConfigAmendment.java:95)
>      at 
> org.apache.sling.serviceusermapping.impl.MappingConfigAmendment.compareTo(MappingConfigAmendment.java:37)
>      at 
> java.util.ComparableTimSort.countRunAndMakeAscending(ComparableTimSort.java:290)
>      at java.util.ComparableTimSort.sort(ComparableTimSort.java:157)
>      at java.util.ComparableTimSort.sort(ComparableTimSort.java:146)
>      at java.util.Arrays.sort(Arrays.java:472)
>      at java.util.Collections.sort(Collections.java:155)
>      at 
> org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.updateMappings(ServiceUserMapperImpl.java:164)
>      at 
> org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.bindAmendment(ServiceUserMapperImpl.java:141)
> {code}
> It seems that a null check is missing at:
> https://github.com/apache/sling/blob/trunk/bundles/commons/osgi/src/main/java/org/apache/sling/commons/osgi/ServiceUtil.java#L70
> {code}
>             if (id.equals(otherId)) {
> {code}
> should be:
> {code}
>             if (id != null && id.equals(otherId)) {
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to