You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Stephen Allen (JIRA)" <ji...@apache.org> on 2011/08/18 20:10:28 UTC

[jira] [Updated] (JENA-104) ReverseComparator fails on Integer.MIN_VALUE

     [ https://issues.apache.org/jira/browse/JENA-104?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stephen Allen updated JENA-104:
-------------------------------

    Attachment: JENA-104-r1159330.patch

> 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