Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
Service User Mapper 1.0.0
-
None
-
None
Description
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:
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)
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
if (id.equals(otherId)) {
should be:
if (id != null && id.equals(otherId)) {