From 711fa0baec0bbf0522d1cdfdf268e1a4108c02f3 Mon Sep 17 00:00:00 2001 From: Mikhail Yankelevich Date: Fri, 9 Jan 2026 16:19:13 +0000 Subject: [PATCH] Weijun's comments --- src/java.base/share/classes/java/security/KeyStore.java | 2 ++ .../share/classes/java/security/KeyStoreSpi.java | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/java.base/share/classes/java/security/KeyStore.java b/src/java.base/share/classes/java/security/KeyStore.java index ae5b26ecf6c..0f0ea31a865 100644 --- a/src/java.base/share/classes/java/security/KeyStore.java +++ b/src/java.base/share/classes/java/security/KeyStore.java @@ -1183,6 +1183,8 @@ public class KeyStore { /** * Returns the creation date of the entry identified by the given alias. + *

+ * Please consider using {@code getCreationTimestamp} instead. * * @param alias the alias name * diff --git a/src/java.base/share/classes/java/security/KeyStoreSpi.java b/src/java.base/share/classes/java/security/KeyStoreSpi.java index 45c9f007ce2..e59fe2a3bd6 100644 --- a/src/java.base/share/classes/java/security/KeyStoreSpi.java +++ b/src/java.base/share/classes/java/security/KeyStoreSpi.java @@ -132,13 +132,19 @@ public abstract class KeyStoreSpi { * Returns the creation timestamp (Instant) of the entry identified * by the given alias. * + * @implSpec This method simply performs + * {@code engineGetCreationDate(alias)} which returns a {@code Date}. + * If the result is not @{code null} returns + * Instance equivalent to received {@code Date}. + * * @param alias the alias name * * @return the creation instant of this entry, or {@code null} * if the given alias does not exist */ public Instant engineGetCreationTimestamp(String alias) { - return engineGetCreationDate(alias).toInstant(); + final Date date = engineGetCreationDate(alias); + return date == null? null : date.toInstant(); } /**