harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Yu (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-6198) [java6][classlib][sql] Timestamp.compareTo returns incorrect result
Date Thu, 07 May 2009 06:40:31 GMT

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

Jim Yu updated HARMONY-6198:
----------------------------

    Attachment: HARMONY-6198.diff

> [java6][classlib][sql] Timestamp.compareTo returns incorrect result
> -------------------------------------------------------------------
>
>                 Key: HARMONY-6198
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6198
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M9
>            Reporter: Jim Yu
>             Fix For: 5.0M10
>
>         Attachments: HARMONY-6198.diff
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> I found Timestamp.compareTo(Date) would return 1 even when both the timestamp and date
object are constructed with the same millisecond values. There is testcase below. I've made
a fix to solve the problem.
> import java.sql.Timestamp;
> import java.util.Date;
> public class TimeStampComp {
>     /**
>      * @param args
>      */
>     public static void main(String[] args) {
>         long time = System.currentTimeMillis();
>         Date date = new Date(time);
>         Timestamp timestamp = new Timestamp(date.getTime());
>         System.out.println("compareTo returns " + timestamp.compareTo(date));
>     }
> }
> Result of RI:
> compareTo returns 0
> Result of Harmony:
> compareTo returns 1

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message