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

Duration.addTo: ambiguity about milliseconds

XMLWordPrintable

    • 1.3
    • generic
    • generic

        Name: erR10175 Date: 10/30/2003



          The documentation of the method

        javax.xml.datatype.Duration.addTo(Calendar calendar)

        is not clear about whether the milliseconds field of Calendar
        object is affected by the method.

        The documentation reads:

        "Calls Calendar.add(int,int) in the order of YEARS, MONTHS, DAYS,
        HOURS, MINUTES, and SECONDS if those fields are present.".

        The class Calendar has fields correspondent to the enumerated ones
        of the class Duration. But the Duration.SECONDS field correspond to
        two different fields Calendar.MILLISECOND and Calendar.SECOND.
        So it is not clear from the documentation, whether the method
        Calendar.add(int, int) is called separately for the fields
        Calendar.MILLISECOND and Calendar.SECOND with correspondent integer
        and fraction parts of Duration.SECONDS (in which order?) or only
        once for Calendar.SECOND with discarded fraction part of the field
        Duration.SECONDS.

        The bug is found in the javadoc of jdk1.5.0/beta/b25

        ======================================================================

              kkawagucsunw Kohsuke Kawaguchi (Inactive)
              reysunw Rey Rey (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: