ReverseComparator fails on Integer.MIN_VALUE
--------------------------------------------

                 Key: JENA-104
                 URL: https://issues.apache.org/jira/browse/JENA-104
             Project: Jena
          Issue Type: Bug
            Reporter: Stephen Allen
            Priority: Minor
         Attachments: JENA-104-r1159330.patch

There is a subtle bug in ReverseComparator. If the forward comparator returned 
Integer.MIN_VALUE, so would the reverse comparator.  Using signed integer 
types, there are more negative numbers available than positive ones (range is 
-2^31 to 2^31-1 inclusive) and negating the minimum value is effectively a 
no-op.  We can avoid the problem by reversing the order of the arguments 
instead.

I've included a patch and tests.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to