ok2c commented on code in PR #874:
URL: 
https://github.com/apache/httpcomponents-client/pull/874#discussion_r3797203906


##########
httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CacheControlHeaderParser.java:
##########
@@ -238,12 +245,31 @@ public final RequestCacheControl parse(final HttpRequest 
request) {
 
     private static long parseSeconds(final String name, final String value) {
         final long delta = CacheSupport.deltaSeconds(value);
-        if (delta == -1 && LOG.isDebugEnabled()) {

Review Comment:
   @dxbjavid Why not making it even simpler?
   
   ```
   public static long deltaSeconds(final String s) {
       if (TextUtils.isEmpty(s)) {
           return -1;
       }
       try {
           long ageValue = Long.parseLong(s);
           if (ageValue < 0) {
               ageValue = -1;  // Handle negative age values as invalid
           } else if (ageValue > Integer.MAX_VALUE) {
               ageValue = MAX_AGE.toSeconds();
           }
           return ageValue;
       } catch (final NumberFormatException ignore) {
           return -Integer.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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to