[ https://issues.apache.org/jira/browse/SLING-4656?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Felix Meschberger resolved SLING-4656. -------------------------------------- Resolution: Fixed Fixed in Rev. 1675805: * Document natural order of ProviderHandler to be the same as service.ranking order. which is the revers of the natural ServiceReference order previously implemented * Added test case by Carsten Ziegeler (thanks)" > 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 > Assignee: 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)