You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2014/03/03 22:29:59 UTC

svn commit: r1573754 - in /commons/proper/lang/trunk/src: changes/changes.xml test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java test/java/org/apache/commons/lang3/time/FastDateParserTest.java

Author: sebb
Date: Mon Mar  3 21:29:58 2014
New Revision: 1573754

URL: http://svn.apache.org/r1573754
Log:
LANG-982 DurationFormatUtils.formatDuration(61999, "s.SSSS") - ms field size should be 4 digits

Modified:
    commons/proper/lang/trunk/src/changes/changes.xml
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.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=1573754&r1=1573753&r2=1573754&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:29:58 2014
@@ -23,6 +23,7 @@
 
   <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>
       
   <release version="3.3" date="TBA" description="Bug fixes and and new features including: DifferenceBuilder, ClassPathUtils, RandomUtils and Jaro-Winkler String distance metric">

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java?rev=1573754&r1=1573753&r2=1573754&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java Mon Mar  3 21:29:58 2014
@@ -531,6 +531,18 @@ public class DurationFormatUtilsTest {
     }
 
     @Test
+    public void testLANG982() { // More than 3 millisecond digits following a second
+        assertEquals("61.999", DurationFormatUtils.formatDuration(61999, "s.S"));
+        assertEquals("1 1999", DurationFormatUtils.formatDuration(61999, "m S"));
+        assertEquals("61.999", DurationFormatUtils.formatDuration(61999, "s.SSS"));
+        assertEquals("1 1999", DurationFormatUtils.formatDuration(61999, "m SSS"));
+        assertEquals("61.0999", DurationFormatUtils.formatDuration(61999, "s.SSSS"));
+        assertEquals("1 1999", DurationFormatUtils.formatDuration(61999, "m SSSS"));
+        assertEquals("61.00999", DurationFormatUtils.formatDuration(61999, "s.SSSSS"));
+        assertEquals("1 01999", DurationFormatUtils.formatDuration(61999, "m SSSSS"));
+    }
+
+    @Test
     public void testDurationsByBruteForce() {
         bruteForce(2006, 0, 1, "d", Calendar.DAY_OF_MONTH);
         bruteForce(2006, 0, 2, "d", Calendar.DAY_OF_MONTH);

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java?rev=1573754&r1=1573753&r2=1573754&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java Mon Mar  3 21:29:58 2014
@@ -220,7 +220,9 @@ public class FastDateParserTest {
             assertEquals(locale.toString()+" "+in+" "+ format+ " "+tz.getID(), in, out);
         } catch (final ParseException pe) {
             System.out.println(fmt+" "+locale.toString()+" "+year+" "+ format+ " "+tz.getID());
-            throw pe;
+            if (year >= 1868 || !locale.getCountry().equals("JP")) {// LANG-978
+                throw pe;
+            }
         }
     }