You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2020/03/28 19:19:28 UTC

[GitHub] [commons-lang] mikolajmitura opened a new pull request #506: LANG-1530 another method like formatDurationWords with

mikolajmitura opened a new pull request #506: LANG-1530 another method like formatDurationWords with 
URL: https://github.com/apache/commons-lang/pull/506
 
 
   added new method 'formatDurationWordsWithMs' for format duration: 
   0 days 0 hours 0 minutes 0 seconds 0 milliseconds
   still exists old method 'formatDurationWords' which format as below:
   0 days 0 hours 0 minutes 0 seconds
    

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [commons-lang] coveralls commented on issue #506: LANG-1530 another method like formatDurationWords with

Posted by GitBox <gi...@apache.org>.
coveralls commented on issue #506: LANG-1530 another method like formatDurationWords with 
URL: https://github.com/apache/commons-lang/pull/506#issuecomment-605600106
 
 
   
   [![Coverage Status](https://coveralls.io/builds/29687152/badge)](https://coveralls.io/builds/29687152)
   
   Coverage increased (+0.007%) to 95.101% when pulling **dc6c6360f86c4bbd8a7a5d330bc4b852a6be3e4a on mikolajmitura:master** into **8c1153d371d4498677605b847f8bfb0e0e743fd5 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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [commons-lang] coveralls edited a comment on issue #506: LANG-1530 another method like formatDurationWords with

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on issue #506: LANG-1530 another method like formatDurationWords with 
URL: https://github.com/apache/commons-lang/pull/506#issuecomment-605600106
 
 
   
   [![Coverage Status](https://coveralls.io/builds/29690322/badge)](https://coveralls.io/builds/29690322)
   
   Coverage increased (+0.007%) to 95.101% when pulling **de7e11faa64fd1002bcbba85891126e1f9ddcb13 on mikolajmitura:master** into **8c1153d371d4498677605b847f8bfb0e0e743fd5 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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [commons-lang] kinow commented on a change in pull request #506: LANG-1530 another method like formatDurationWords with

Posted by GitBox <gi...@apache.org>.
kinow commented on a change in pull request #506: LANG-1530 another method like formatDurationWords with 
URL: https://github.com/apache/commons-lang/pull/506#discussion_r399778674
 
 

 ##########
 File path: src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
 ##########
 @@ -171,56 +175,96 @@ public static String formatDuration(final long durationMillis, final String form
      * @throws java.lang.IllegalArgumentException if durationMillis is negative
      */
     public static String formatDurationWords(
-        final long durationMillis,
-        final boolean suppressLeadingZeroElements,
-        final boolean suppressTrailingZeroElements) {
-
-        // This method is generally replaceable by the format method, but
-        // there are a series of tweaks and special cases that require
-        // trickery to replicate.
-        String duration = formatDuration(durationMillis, "d' days 'H' hours 'm' minutes 's' seconds'");
+            final long durationMillis,
+            final boolean suppressLeadingZeroElements,
+            final boolean suppressTrailingZeroElements) {
+        return formatDurationWordsWithMs(durationMillis, false,
+                                         suppressLeadingZeroElements, suppressTrailingZeroElements);
+    }
+
+    /**
+     * <p>Formats an elapsed time into a pluralization correct string.</p>
+     * <p>Returns duration in format '0 days 0 hours 0 minutes 0 seconds 0 milliseconds'</p>
+     * It removes all leading time units with 0 value.
 
 Review comment:
   Dangling text. Was it supposed to be within the previous `<p>`?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [commons-lang] mikolajmitura commented on a change in pull request #506: LANG-1530 another method like formatDurationWords with

Posted by GitBox <gi...@apache.org>.
mikolajmitura commented on a change in pull request #506: LANG-1530 another method like formatDurationWords with 
URL: https://github.com/apache/commons-lang/pull/506#discussion_r399805688
 
 

 ##########
 File path: src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
 ##########
 @@ -171,56 +175,96 @@ public static String formatDuration(final long durationMillis, final String form
      * @throws java.lang.IllegalArgumentException if durationMillis is negative
      */
     public static String formatDurationWords(
-        final long durationMillis,
-        final boolean suppressLeadingZeroElements,
-        final boolean suppressTrailingZeroElements) {
-
-        // This method is generally replaceable by the format method, but
-        // there are a series of tweaks and special cases that require
-        // trickery to replicate.
-        String duration = formatDuration(durationMillis, "d' days 'H' hours 'm' minutes 's' seconds'");
+            final long durationMillis,
+            final boolean suppressLeadingZeroElements,
+            final boolean suppressTrailingZeroElements) {
+        return formatDurationWordsWithMs(durationMillis, false,
+                                         suppressLeadingZeroElements, suppressTrailingZeroElements);
+    }
+
+    /**
+     * <p>Formats an elapsed time into a pluralization correct string.</p>
+     * <p>Returns duration in format '0 days 0 hours 0 minutes 0 seconds 0 milliseconds'</p>
+     * It removes all leading time units with 0 value.
 
 Review comment:
   aligned to previous <p>

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [commons-lang] kinow commented on a change in pull request #506: LANG-1530 another method like formatDurationWords with

Posted by GitBox <gi...@apache.org>.
kinow commented on a change in pull request #506: LANG-1530 another method like formatDurationWords with 
URL: https://github.com/apache/commons-lang/pull/506#discussion_r399778593
 
 

 ##########
 File path: src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
 ##########
 @@ -160,6 +163,7 @@ public static String formatDuration(final long durationMillis, final String form
 
     /**
      * <p>Formats an elapsed time into a pluralization correct string.</p>
+     * <p>Returns duration in format '0 days 0hours 0 minutes 0 seconds'</p>
 
 Review comment:
   s/0hours/0 hours

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [commons-lang] garydgregory commented on issue #506: LANG-1530 another method like formatDurationWords with

Posted by GitBox <gi...@apache.org>.
garydgregory commented on issue #506: LANG-1530 another method like formatDurationWords with 
URL: https://github.com/apache/commons-lang/pull/506#issuecomment-606008656
 
 
   Hi All,
   
   Before we make this class heavier, let's step back and consider what Java 8's own [Duration](https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html) and [Period](https://docs.oracle.com/javase/8/docs/api/java/time/Period.html) classes have to offer and how this class should interact/interface with these.
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [commons-lang] mikolajmitura commented on a change in pull request #506: LANG-1530 another method like formatDurationWords with

Posted by GitBox <gi...@apache.org>.
mikolajmitura commented on a change in pull request #506: LANG-1530 another method like formatDurationWords with 
URL: https://github.com/apache/commons-lang/pull/506#discussion_r399805521
 
 

 ##########
 File path: src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
 ##########
 @@ -160,6 +163,7 @@ public static String formatDuration(final long durationMillis, final String form
 
     /**
      * <p>Formats an elapsed time into a pluralization correct string.</p>
+     * <p>Returns duration in format '0 days 0hours 0 minutes 0 seconds'</p>
 
 Review comment:
   fixed all 0hours 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [commons-lang] kinow commented on issue #506: LANG-1530 another method like formatDurationWords with

Posted by GitBox <gi...@apache.org>.
kinow commented on issue #506: LANG-1530 another method like formatDurationWords with 
URL: https://github.com/apache/commons-lang/pull/506#issuecomment-606248887
 
 
   > Hi All,
   > 
   > Before we make this class heavier, let's step back and consider what Java 8's own [Duration](https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html) and [Period](https://docs.oracle.com/javase/8/docs/api/java/time/Period.html) classes have to offer and how this class should interact/interface with these.
   
   +1
   
   I had a quick look at the code, but didn't want to prepare a review before checking if we run the risk of needing one more test to display time zone with micro seconds, and yet more methods for other things.
   
   Good idea on looking at the SDK classes first.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services