On Mon, 23 Mar 2026 13:59:02 GMT, Jaikiran Pai <[email protected]> wrote:

>> It might be easier to make `expiryDate2DeltaSeconds` a static method and 
>> then have it return the `Calendar` instance if the parsing completes 
>> successfully. The call site can then use that non-null `Calendar` instance 
>> to trivially compute the remaining time since the cookie was created. A 
>> `null` return from `expiryDate2DeltaSeconds` would then imply that the 
>> expiry date couldn't be computed and is thus unusable.
>
> Of course, that would also mean renaming the method to something like 
> `parseExpires`.

Thanks for the suggestion @jaikiran. I've refactored expiryDate2DeltaSeconds 
into a static parseExpires method that returns the parsed Calendar, or null on 
failure.

The delta calculation is now done at the call site.

Also removed the EXPIRY_DATE_PARSE_FAILURE constant, the unnecessary try-catch 
around the expires handling, and updated the method comment and B6791927.java 
@summary.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/30341#discussion_r2975520498

Reply via email to