jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tobias Bocanegra (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (JCR-687) UUID compareTo and hashCode
Date Thu, 21 Dec 2006 14:29:35 GMT
     [ http://issues.apache.org/jira/browse/JCR-687?page=all ]

Tobias Bocanegra resolved JCR-687.
----------------------------------

    Fix Version/s: 1.2
       Resolution: Fixed

Committed revision 489369 to trunk

> UUID compareTo and hashCode
> ---------------------------
>
>                 Key: JCR-687
>                 URL: http://issues.apache.org/jira/browse/JCR-687
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: core
>            Reporter: Thomas Mueller
>         Assigned To: Tobias Bocanegra
>            Priority: Minor
>             Fix For: 1.2
>
>         Attachments: uuid.txt
>
>
> The current UUID.compareTo implementation is not correct. Usually, 'equals' is used so
this is not a big problem, but I need to create an ordered list of UUIDs and for this I need
compareTo. The current implementation is based on subtraction, but this doesn't always work.
Example:
> //long a = 10, b = 20, c = 0;
> long a = Long.MAX_VALUE, b = Long.MIN_VALUE, c = 0;
> System.out.println((a - b) < 0 ? "a < b" : "a >= b");
> System.out.println((c - a) < 0 ? "c < a" : "c >= a");
> System.out.println((b - c) < 0 ? "b < c" : "b >= c");
> The hashCode implementation is OK, but the multiplication is not required.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message