Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1003

DurationFormatUtils are not able to handle negative durations/periods

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 3.3.2
    • 3.4
    • lang.text.*
    • None

    Description

      It spits out complete garbage.

      System.out.println(DurationFormatUtils.formatDurationHMS(-3454));
      System.out.println(DurationFormatUtils.formatPeriodISO(4000, 3000));
      
      0:00:-3.-454
      P-1Y11M30DT23H59M59.000S
      

      It should throw an IllegalArgumentException if duration is < 0 or period diff is < 0.

      Attachments

        Activity

          People

            britter Benedikt Ritter
            michael-o Michael Osipov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: