harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pavel Pervov (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-4510) [classlib][luni][regression] GregorianCalendar.roll works incorrectly.
Date Fri, 20 Jul 2007 14:36:06 GMT
[classlib][luni][regression] GregorianCalendar.roll works incorrectly.
----------------------------------------------------------------------

                 Key: HARMONY-4510
                 URL: https://issues.apache.org/jira/browse/HARMONY-4510
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Pavel Pervov


Consider the following test case:
---------------------------------------
import java.util.Date;
import java.util.TimeZone;
import java.util.GregorianCalendar;

class jugc {
    public static void main(String[] args) {
        GregorianCalendar cal =
            new GregorianCalendar(TimeZone.getTimeZone("GMT"));
        Date d = new Date(99, 11, 31, 23, 59, 59);

        cal.setTime(d);
        cal.roll(GregorianCalendar.WEEK_OF_MONTH, true);
        cal.roll(GregorianCalendar.WEEK_OF_MONTH, false);
        if(f(cal.getTime()) == f(d)) {
            System.out.println("PASSED");
        } else {
            System.out.println("FAILED: expected (" +
                   f(cal.getTime()) + ") got (" +
                   f(d) + ")");
        }
        
    }

    static long f(Date di) { return di.getTime(); }
}
---------------------------------------
Result from RI is "PASSED".
Result from Harmony is "FAILED: expected (946069199000) got (946673999000)"

It looks like when rolling one week back it returns to December 24th, instead of December
31th.

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