On Fri, 21 Aug 2026 20:36:52 GMT, Mikhail Yankelevich 
<[email protected]> wrote:

>> src/java.base/share/classes/java/security/cert/X509Certificate.java line 192:
>> 
>>> 190:      * @throws    NullPointerException if the supplied instant is 
>>> {@code null}.
>>> 191:      * @throws    IllegalArgumentException if supplied instant is 
>>> outside the
>>> 192:      * range supported by Date (e.g., Instant.MAX).
>> 
>> The conversion to `Date` is an implementation detail of the default 
>> implementation and does not belong to the spec.
>> 
>> In fact, there is no need to fail in this case. We can
>> 
>> * @implSpec
>>      * The default implementation converts the specified {@code Instant} to
>>      * a {@code Date} using the {@link Date#from(Instant)} method and calls
>>      * {@code checkValidity(Date)} on the result. Note that converting to a
>>      * {@code Date} will cause any excess nanoseconds in the instant to be
>>      * truncated. If {@code instant} falls outside the range representable by
>>      * {@code Date}, the nearest {@code Date} is used. For instants too large
>>      * to be represented as a {@code Date}, {@code new Date(Long.MAX_VALUE)}
>>      * is used, and for instants too small to be represented as a {@code 
>> Date},
>>      * {@code new Date(Long.MIN_VALUE)} is used.
>
> Done. 
> 
> Just FYI, the code changed to prevent IlligalArgumentException now, it 
> catches the exception so the check is not triggered on every call, since this 
> should be very rare occurance. 
> 
> Please let me know if you prefer to have an if statement before date 
> assignment.

Changed to if statements

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30047#discussion_r3839598233

Reply via email to