[
https://issues.apache.org/jira/browse/LANG-986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16405588#comment-16405588
]
Daniel Dowd commented on LANG-986:
----------------------------------
[[email protected]]
After a little bit of looking at this issue.
formatDurationISO can pass an ISO 8601 format string into formatDuration. Even
though formatDuration does not concern itself with Months or Years it is needed
for the ISO 8601 format so straight validation of the Month/Year format char
would break that piece of functionality.
Should each variation of the formatDuration method then validate the format
string passed in according to it's specifications?
> DurationFormatUtils.formatDuration accepts formats with year/month but cannot
> use them
> --------------------------------------------------------------------------------------
>
> Key: LANG-986
> URL: https://issues.apache.org/jira/browse/LANG-986
> Project: Commons Lang
> Issue Type: Improvement
> Components: lang.time.*
> Reporter: Sebb
> Priority: Major
> Fix For: Discussion
>
>
> The method DurationFormatUtils.formatDuration does not validate that the
> format is applicable. The method does not calculate months and years, so
> these values will be 0 if the format contains y or M.
> Perhaps the method should throw IAE if one of the unused format chars is used?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)