renamed timestamp to instant

This commit is contained in:
Mikhail Yankelevich 2026-01-14 14:21:01 +00:00
parent 7153c9e3c5
commit 02f46daf12
8 changed files with 31 additions and 31 deletions

View File

@ -406,7 +406,7 @@ abstract sealed class KeychainStore extends KeyStoreSpi {
* not exist
*/
public Date engineGetCreationDate(String alias) {
final Instant instant = this.engineGetCreationTimestamp(alias);
final Instant instant = this.engineGetCreationInstant(alias);
if (instant == null){
return null;
}
@ -424,7 +424,7 @@ abstract sealed class KeychainStore extends KeyStoreSpi {
*
* @since 27
*/
public Instant engineGetCreationTimestamp(String alias) {
public Instant engineGetCreationInstant(String alias) {
final Object entry = entries.get(alias.toLowerCase(Locale.ROOT));
if (entry != null) {

View File

@ -214,7 +214,7 @@ public final class JceKeyStore extends KeyStoreSpi {
* not exist
*/
public Date engineGetCreationDate(String alias) {
final Instant instant = this.engineGetCreationTimestamp(alias);
final Instant instant = this.engineGetCreationInstant(alias);
if (instant == null){
return null;
}
@ -222,7 +222,7 @@ public final class JceKeyStore extends KeyStoreSpi {
}
/**
* Returns the creation timestamp as an {@code Instant} value
* Returns the creation {@code Instant} value
* of the entry identified by the given alias.
*
* @param alias the alias name
@ -232,7 +232,7 @@ public final class JceKeyStore extends KeyStoreSpi {
*
* @since 27
*/
public Instant engineGetCreationTimestamp(String alias) {
public Instant engineGetCreationInstant(String alias) {
final Object entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
if (entry != null) {

View File

@ -1185,7 +1185,7 @@ public class KeyStore {
* Returns the creation date of the entry identified by the given alias.
* <p>
* This method returns a Date, which is mutable and more error-prone.
* Use getCreationTimestamp() instead.
* Use {@link #getCreationInstant(String)} instead.
*
* @param alias the alias name
*
@ -1206,7 +1206,7 @@ public class KeyStore {
/**
* Returns the creation timestamp as an {@code Instant} value
* Returns the creation {@code Instant} value
* of the entry identified by the given alias.
*
* @param alias the alias name
@ -1219,13 +1219,13 @@ public class KeyStore {
*
* @since 27
*/
public final Instant getCreationTimestamp(String alias)
public final Instant getCreationInstant(String alias)
throws KeyStoreException
{
if (!initialized) {
throw new KeyStoreException("Uninitialized keystore");
}
return keyStoreSpi.engineGetCreationTimestamp(alias);
return keyStoreSpi.engineGetCreationInstant(alias);
}

View File

@ -129,12 +129,12 @@ public abstract class KeyStoreSpi {
public abstract Date engineGetCreationDate(String alias);
/**
* Returns the creation timestamp as an {@code Instant} value
* Returns the creation {@code Instant} value
* of the entry identified by the given alias.
*
* @implSpec
* The default implementation calls {@code engineGetCreationDate(alias)}
* and returns the output as an {@code Instant} value.
* and returns the output as an {@code Instant} value.
*
* @param alias the alias name
*
@ -143,7 +143,7 @@ public abstract class KeyStoreSpi {
*
* @since 27
*/
public Instant engineGetCreationTimestamp(String alias) {
public Instant engineGetCreationInstant(String alias) {
final Date date = engineGetCreationDate(alias);
return date == null ? null : date.toInstant();
}

View File

@ -542,7 +542,7 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
* not exist
*/
public Date engineGetCreationDate(String alias) {
final Instant instant = this.engineGetCreationTimestamp(alias);
final Instant instant = this.engineGetCreationInstant(alias);
if (instant == null){
return null;
}
@ -550,7 +550,7 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
}
/**
* Returns the creation timestamp as an {@code Instant} value
* Returns the creation {@code Instant} value
* of the entry identified by the given alias.
*
* @param alias the alias name
@ -560,7 +560,7 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
*
* @since 27
*/
public Instant engineGetCreationTimestamp(String alias) {
public Instant engineGetCreationInstant(String alias) {
final Entry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
if (entry != null) {
return entry.date;

View File

@ -236,7 +236,7 @@ abstract class DomainKeyStore extends KeyStoreSpi {
}
/**
* Returns the creation timestamp as an {@code Instant} value
* Returns the creation {@code Instant} value
* of the entry identified by the given alias.
*
* @param alias the alias name
@ -246,7 +246,7 @@ abstract class DomainKeyStore extends KeyStoreSpi {
*
* @since 27
*/
public Instant engineGetCreationTimestamp(String alias) {
public Instant engineGetCreationInstant(String alias) {
AbstractMap.SimpleEntry<String, Collection<KeyStore>> pair =
getKeystoresForReading(alias);
@ -255,7 +255,7 @@ abstract class DomainKeyStore extends KeyStoreSpi {
try {
String entryAlias = pair.getKey();
for (KeyStore keystore : pair.getValue()) {
instant = keystore.getCreationTimestamp(entryAlias);
instant = keystore.getCreationInstant(entryAlias);
if (instant != null) {
break;
}

View File

@ -237,14 +237,14 @@ public abstract sealed class JavaKeyStore extends KeyStoreSpi {
* not exist
*/
public Date engineGetCreationDate(String alias) {
final Instant instant = this.engineGetCreationTimestamp(alias);
final Instant instant = this.engineGetCreationInstant(alias);
return instant == null ? null : Date.from(instant);
}
/**
* Returns the creation timestamp as an {@code Instant} value
* Returns the creation {@code Instant} value
* of the entry identified by the given alias.
*
* @param alias the alias name
@ -254,7 +254,7 @@ public abstract sealed class JavaKeyStore extends KeyStoreSpi {
*
* @since 27
*/
public Instant engineGetCreationTimestamp(String alias) {
public Instant engineGetCreationInstant(String alias) {
final Object entry = entries.get(convertAlias(alias));
if (entry != null) {

View File

@ -182,7 +182,7 @@ public class TestKeyStoreBasic {
// compare the creation date of the 2 key stores for all aliases
compareCreationDate(ks, ks2, numEntries);
compareCreationTimestamp(ks, ks2, numEntries);
compareCreationInstant(ks, ks2, numEntries);
// remove the last entry from the 2nd key store
numEntries--;
@ -220,7 +220,7 @@ public class TestKeyStoreBasic {
// compare the creation date of the 2 key stores for all aliases
compareCreationDate(ks, ks2, numEntries);
compareCreationTimestamp(ks, ks2, numEntries);
compareCreationInstant(ks, ks2, numEntries);
// check setEntry/getEntry with a password protection algorithm
if ("PKCS12".equalsIgnoreCase(ks.getType())) {
@ -292,22 +292,22 @@ public class TestKeyStoreBasic {
}
}
// compare the creation timestamps - true if all the same
private void compareCreationTimestamp(KeyStore o1, KeyStore o2, int range)
// compare the creation instants - true if all the same
private void compareCreationInstant(KeyStore o1, KeyStore o2, int range)
throws KeyStoreException {
String alias;
for (int k = 0; k < range; k++) {
alias = ALIAS_HEAD + k;
final Instant timestampO1 = o1.getCreationTimestamp(alias);
final Instant timestampO2 = o2.getCreationTimestamp(alias);
final int diff = timestampO1.compareTo(timestampO2);
final Instant instant1 = o1.getCreationInstant(alias);
final Instant instant2 = o2.getCreationInstant(alias);
final int diff = instant1.compareTo(instant2);
// There could be a difference in nano seconds on some machines
// so comparing with precision of 1 ms
if (!(diff >= 0 && diff <= 1000000)) {
throw new RuntimeException("ERROR: entry creation time (" + k
+ ") differs using Instance {"
+ timestampO1 + " - "
+ timestampO2 + "}");
+ ") differs Instants {"
+ instant1 + " - "
+ instant2 + "}");
}
}
}