[ http://issues.apache.org/jira/browse/LANG-281?page=all ]
Henri Yandell resolved LANG-281.
--------------------------------
Resolution: Fixed
svn ci -m "Adding a unit test for #LANG-281 and a fix. The fix involves
removing the reduceAndCorrect method. It appears that this method was doing sod
all - which is worrying as it used to be important. I'm guessing that it was a
bad fix for a bug that was then subsequently fixed with other code. I'll create
a JIRA issue to create more tests to test out the +31 block of code. "
Sending src/java/org/apache/commons/lang/time/DurationFormatUtils.java
Sending
src/test/org/apache/commons/lang/time/DurationFormatUtilsTest.java
Transmitting file data ..
Committed revision 453818.
> DurationFormatUtils returns wrong result
> ----------------------------------------
>
> Key: LANG-281
> URL: http://issues.apache.org/jira/browse/LANG-281
> Project: Commons Lang
> Issue Type: Bug
> Affects Versions: 2.1, 2.2
> Environment: Win xp pro
> Reporter: stlum9495
> Fix For: 2.3
>
> Attachments: LANG-281-fix.patch, LANG-281-test.patch
>
>
> DurationFormatUtils returns wrong result. oddly, it is only when Date is set
> to Dec 31, 2005
> The following code will result in a String of -2 which is way off.
> I've tested against 2.1 and 2.2.
> Calendar cal = Calendar.getInstance();
> cal.set(Calendar.MONTH, Calendar.DECEMBER);
> cal.set(Calendar.DAY_OF_MONTH, 31);
> cal.set(Calendar.YEAR, 2005);
> cal.set(Calendar.HOUR_OF_DAY, 0);
> cal.set(Calendar.MINUTE, 0);
> cal.set(Calendar.SECOND, 0);
> cal.set(Calendar.MILLISECOND, 0);
> String result =
> DurationFormatUtils.formatPeriod(cal.getTimeInMillis(),
> System.currentTimeMillis(), "MM");
> System.out.println(result);
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]