On Mon, 23 Mar 2026 13:44:51 GMT, EunHyunsu <[email protected]> wrote:

>> I agree with Volkan, I think a class level constant like this isn't needed 
>> in this case. Returning `-1` should be fine to indicate that the value 
>> couldn't be parsed.
>
> Thanks for the feedback. I'll remove the constant and return -1 directly.
> 
> One thing I wanted to confirm: if the parsed date happens to be exactly 1 
> second before the creation time, the delta would also be -1. In that case, it 
> would be treated as a parse failure instead of an expired cookie. Is that 
> acceptable, or should I use a value that can't collide with a real delta?

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.

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

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

Reply via email to