RankingComparator results in wrong results
------------------------------------------
Key: FELIX-3175
URL: https://issues.apache.org/jira/browse/FELIX-3175
Project: Felix
Issue Type: Bug
Components: Configuration Admin
Affects Versions: configadmin-1.2.10
Reporter: Felix Meschberger
Assignee: Felix Meschberger
Fix For: configadmin-1.2.12
The RankingComparator class works perfectly ordering ServiceReference instances
according to the specification. When applied to array sorting (Arrays.sort) and
sorted sets (TreeSet), the resulting order is from lowest to highest
ServiceReference thus not returning the highest ranking service first.
This is wrong: the highest ranking service should be sorted on the first
position and the lowest ranking service should be placed on the last position.
To fix this, the RankingComparator should return revers results:
-1 if service1 is higher than service2
0 if service1 is the same as service2 (according to service id)
+1 if service1 is lower than service2
This should also be tested using unit tests.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira