incubator-jena-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Allen (JIRA)" <>
Subject [jira] [Created] (JENA-104) ReverseComparator fails on Integer.MIN_VALUE
Date Thu, 18 Aug 2011 18:10:28 GMT
ReverseComparator fails on Integer.MIN_VALUE

                 Key: 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

I've included a patch and tests.

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message