You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Jim Yu (JIRA)" <ji...@apache.org> on 2009/05/07 08:40:31 UTC

[jira] Updated: (HARMONY-6198) [java6][classlib][sql] Timestamp.compareTo returns incorrect result

     [ 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.