commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1573756 - in /commons/proper/lang/trunk/src: changes/changes.xml main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
Date Mon, 03 Mar 2014 21:32:08 GMT
Author: sebb
Date: Mon Mar  3 21:32:07 2014
New Revision: 1573756

URL: http://svn.apache.org/r1573756
Log:
LANG-978 Failing tests with Java 8 b128

Modified:
    commons/proper/lang/trunk/src/changes/changes.xml
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java

Modified: commons/proper/lang/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/changes/changes.xml?rev=1573756&r1=1573755&r2=1573756&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/changes/changes.xml [utf-8] (original)
+++ commons/proper/lang/trunk/src/changes/changes.xml [utf-8] Mon Mar  3 21:32:07 2014
@@ -24,7 +24,8 @@
   <release version="3.4" date="TBA" description="TBA">
     <action issue="LANG-984" type="fix" dev="sebb">DurationFormatUtils does not handle
large durations correctly</action>
     <action issue="LANG-982" type="fix" dev="sebb">DurationFormatUtils.formatDuration(61999,
"s.SSSS") - ms field size should be 4 digits</action>
-  </release>
+    <action issue="LANG-978" type="fix" dev="sebb">Failing tests with Java 8 b128</action>
+    </release>
       
   <release version="3.3" date="TBA" description="Bug fixes and and new features including:
DifferenceBuilder, ClassPathUtils, RandomUtils and Jaro-Winkler String distance metric">
     <action issue="LANG-621" type="fix" dev="kinow" due-to="Philip Hodges, Thomas Neidhart">ReflectionToStringBuilder.toString
does not debug 3rd party object fields within 3rd party object</action>

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java?rev=1573756&r1=1573755&r2=1573756&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
(original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
Mon Mar  3 21:32:07 2014
@@ -442,12 +442,10 @@ public class DurationFormatUtils {
                     buffer.append(paddedValue(seconds, padWithZeros, count));
                     lastOutputSeconds = true;
                 } else if (value == S) {
-                    if (lastOutputSeconds) {
-                        milliseconds += 1000;
-                        final String str = padWithZeros
-                                ? StringUtils.leftPad(Long.toString(milliseconds), count,
'0')
-                                : Long.toString(milliseconds);
-                        buffer.append(str.substring(1));
+                    if (lastOutputSeconds) { 
+                        // ensure at least 3 digits are displayed even if padding is not
selected
+                        int width = padWithZeros ? Math.max(3, count) : 3;
+                        buffer.append(paddedValue(milliseconds, true, width));
                     } else {
                         buffer.append(paddedValue(milliseconds, padWithZeros, count));
                     }



Mime
View raw message