commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benedikt Ritter (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-1004) DurationFormatUtils#formatDurationHMS implementation does not correspond to Javadoc and vice versa
Date Sun, 04 May 2014 09:30:16 GMT

    [ https://issues.apache.org/jira/browse/LANG-1004?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13988950#comment-13988950
] 

Benedikt Ritter commented on LANG-1004:
---------------------------------------

Hello Michael, 

After applying your patch I get two test failures:

{code}
Failed tests: 
  StopWatchTest.testStopWatchSimpleGet:55 expected:<0[]:00:00.000> but was:<0[0]:00:00.000>
  StopWatchTest.testStopWatchSplit:76 Formatted split string not the correct length expected:<12>
but was:<11>
{code}

Those two test cases fail because StopWatch uses DurationFormatUtils internally. You will
have to update the tests as well ;)

TIA!
Benedikt

> DurationFormatUtils#formatDurationHMS implementation does not correspond to Javadoc and
vice versa
> --------------------------------------------------------------------------------------------------
>
>                 Key: LANG-1004
>                 URL: https://issues.apache.org/jira/browse/LANG-1004
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.text.*
>    Affects Versions: 3.3.2
>            Reporter: Michael Osipov
>             Fix For: Patch Needed
>
>         Attachments: LANG-1004.patch, LANG-1004_v2.patch
>
>
> This method has several flaws:
> 1. Javadoc says: "The format used is ISO8601-like: H:m:s.S." but the method call supplies
"H:mm:ss.SSS"
> 2. ISO time never omits leading zeros, so the proper pattern must be "HH:mm:ss.SSS"
> 3. The method name says: "HMS" but includes the second fraction.
> Since the use of fractions is optional, the method should use "HH:mm:ss" and update the
Javadoc as well.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message