ok2c commented on code in PR #512:
URL: 
https://github.com/apache/httpcomponents-core/pull/512#discussion_r1910275830


##########
httpcore5/src/main/java/org/apache/hc/core5/util/Deadline.java:
##########
@@ -83,8 +83,11 @@ public class Deadline {
      */
     public static Deadline calculate(final long timeMillis, final TimeValue 
timeValue) {
         if (TimeValue.isPositive(timeValue)) {
-            // TODO handle unlikely overflow
-            final long deadline = timeMillis + timeValue.toMilliseconds();
+            final long timeToAdd = timeValue.toMilliseconds();

Review Comment:
   @arturobernalg Should not this do the same, just with a bit less code? I 
also think `timeToAdd > 0`  and `deadline < 0` are unnecessary.
   
   ```
           if (TimeValue.isPositive(timeValue)) {
               return Deadline.fromUnixMilliseconds(timeMillis +
                       Math.min(timeValue.toMilliseconds(), Long.MAX_VALUE - 
timeMillis));
           }
           return Deadline.MAX_VALUE;
   ```



-- 
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.

To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to