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

Duration.toString violates specification

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 8, 9
    • core-libs
    • b101
    • generic
    • generic

      FULL PRODUCT VERSION :
      java version "1.8.0_66"
      Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
      Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      In the JavaDoc, for Duration.toString, it is specified that the "hours, minutes and seconds will all have the same sign". However, this is violated in certain cases. For instance, while Duration.ofSeconds(-59, 100000000) correctly prints as "PT-58.9S", Duration.ofSeconds(-60, 100000000) prints as "PT-1M0.1S" with a negative minute, but a positive second, when "PT-59.9S" would be the expected result.


      REPRODUCIBILITY :
      This bug can be reproduced always.

            ntv Nadeesh Tv
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: