[ 
https://issues.apache.org/jira/browse/SLING-4656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14510660#comment-14510660
 ] 

Felix Meschberger commented on SLING-4656:
------------------------------------------

Thanks for the tests. 

Will fix compareTo as proposed (sounds to be the better option to me as well)

> ProviderHandler implements compareTo incorreclty
> ------------------------------------------------
>
>                 Key: SLING-4656
>                 URL: https://issues.apache.org/jira/browse/SLING-4656
>             Project: Sling
>          Issue Type: Bug
>          Components: ResourceResolver
>    Affects Versions: Resource Resolver 1.2.4
>            Reporter: Felix Meschberger
>             Fix For: Resource Resolver 1.2.6
>
>
> The implementation of the ResourceResolver's compareTo method is wrong as it 
> favors services registered later over services registered earlier, while 
> older services should actually be preferred (assuming there sevice.ranking 
> values are equal). In essence it implements natural ServiceReference ordering 
> instead of ranking order which is the inverse.
> Two options to fix:
> * Fix ProviderHandler.compareTo to implement service ranking and thus revers 
> of natural ordering
> * Fix ResourceProviderEntry.conditionalSort to use a reverse comparator
> While at it, the extraction of the service.ranking property is overly complex 
> since it first checks for null and then for the correct type. This can be 
> simplified by just checking for the correct type as a null value never 
> matches any type.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to