Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8152077

(cal) Calendar.roll does not always roll the hours during daylight savings changes

    XMLWordPrintable

Details

    • b113
    • generic
    • generic
    • Verified

    Backports

      Description

        FULL PRODUCT VERSION :


        A DESCRIPTION OF THE PROBLEM :
        On the day of DST changes, Calendar.roll does not roll the hour 23.
        However, its javadoc states that it will "add a single unit of time".

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Run this snippet:

        final Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("CST"));
        cal.setTimeInMillis(1457928024812l);

        System.out.println(cal.getTime());
        cal.roll(Calendar.HOUR_OF_DAY, true);
        System.out.println(cal.getTime());


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Output
        Sun Mar 13 23:00:24 CDT 2016
        Sun Mar 13 00:00:24 CDT 2016
        ACTUAL -
        Output:
        Sun Mar 13 23:00:24 CDT 2016
        Sun Mar 13 23:00:24 CDT 2016

        REPRODUCIBILITY :
        This bug can be reproduced always.

        Attachments

          Issue Links

            Activity

              People

                okutsu Masayoshi Okutsu
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: