[
https://issues.apache.org/jira/browse/LANG-1629?focusedWorklogId=526829&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-526829
]
ASF GitHub Bot logged work on LANG-1629:
----------------------------------------
Author: ASF GitHub Bot
Created on: 21/Dec/20 14:33
Start Date: 21/Dec/20 14:33
Worklog Time Spent: 10m
Work Description: coveralls commented on pull request #678:
URL: https://github.com/apache/commons-lang/pull/678#issuecomment-749003415
[](https://coveralls.io/builds/35864827)
Coverage remained the same at 95.016% when pulling
**92af68df33eba355d84d9571c7a9a4721e422c73 on
JuHyun419:LANG-1629-DurationFormatUtils** into
**d704c0dc70a2f861c043785822854b4a0605ac6b on apache:master**.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 526829)
Time Spent: 20m (was: 10m)
> DurationFormatUtils.formatPeriod is infinite repetition when parameter is
> negative number
> -----------------------------------------------------------------------------------------
>
> Key: LANG-1629
> URL: https://issues.apache.org/jira/browse/LANG-1629
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.time.*
> Affects Versions: 3.11
> Reporter: LeeJuHyun
> Priority: Major
> Fix For: Discussion
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> if parameter number(*startMillis*, *endMillis*) is negative number then below
> while loop is infinite repetition. (278 line ~)
> {code:java}
> public static String formatPeriod(final long startMillis, final long
> endMillis, final String format, final boolean padWithZeros,
> final TimeZone timezone) {
> Validate.isTrue(startMillis <= endMillis, "startMillis must not be
> greater than endMillis");
> // Used to optimise for differences under 28 days and
> // called formatDuration(millis, format); however this did not work
> // over leap years.
> // TODO: Compare performance to see if anything was lost by
> // losing this optimisation.
> final Token[] tokens = lexx(format);
> // ...
> while (start.get(Calendar.YEAR) != target) {
> days += start.getActualMaximum(Calendar.DAY_OF_YEAR) -
> start.get(Calendar.DAY_OF_YEAR);
> // Not sure I grok why this is needed, but the brutal tests show it is
> if (start instanceof GregorianCalendar &&
> start.get(Calendar.MONTH) == Calendar.FEBRUARY &&
> start.get(Calendar.DAY_OF_MONTH) == 29) {
> days += 1;
> }
> start.add(Calendar.YEAR, 1);
> days += start.get(Calendar.DAY_OF_YEAR);
> }{code}
>
> How about putting in a validation to determine whether it's negative or
> positive?
>
> thank you :)
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)