I would check if you ever reach the final return 0 of your compareTo(). Apparently you should not, so if you reach it, maybe it's better to throw an exception for troubleshooting purposes. What I suspect is that sometimes one of the doubles to compare is Double.NaN, which according to the JLS "All numeric operations with NaN as an operand produce NaN as a result. As has already been described, NaN is unordered, so a numeric comparison operation involving one or two NaNs returns false and any != comparison involving NaN returns true, including x!=x when x is NaN". If this is the case, you should check where do you produce a Double.NaN as ranking. The JLS again: "an operation that has no mathematically definite result produces NaN". You may also try to use Double.isNan() and Double.compareTo(), which hints that relaying on comparison operators with doubles is not quite right.
Post the rest of the code. You haven't posted any code that shows how 'ranking' is getting populated, how the list is getting populated.
But most of the times it is returning this exception message:
How many items are in the list being sorted? Before sorting iterate the list and print out all of the 'ranking' values so you can see what they are.