On Mon, 23 Mar 2026 13:37:51 GMT, Jaikiran Pai <[email protected]> wrote:
>> src/java.base/share/classes/java/net/HttpCookie.java line 96: >> >>> 94: // Returned by expiryDate2DeltaSeconds when none of the date formats >>> 95: // could parse the given expires value >>> 96: private static final long EXPIRY_DATE_PARSE_FAILURE = >>> Long.MIN_VALUE; >> >> I'd have just hardcoded `-1`, documented in `expiryDate2DeltaSeconds`, and >> be done with it. I'm not really sure if a constant sentinel is necessary. I >> will leave that decision to @dfuch, who first [triaged] this issue. >> >> [triaged]: https://mail.openjdk.org/pipermail/net-dev/2026-March/030263.html > > 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? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/30341#discussion_r2975133648
