mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8289274: Cleanup unnecessary null comparison before instanceof check in security modules
Reviewed-by: mullan
This commit is contained in:
parent
81ee7d28f8
commit
87aa3ce03e
14 changed files with 54 additions and 94 deletions
|
@ -183,12 +183,12 @@ public final class KeychainStore extends KeyStoreSpi {
|
|||
|
||||
Object entry = entries.get(alias.toLowerCase());
|
||||
|
||||
if (entry == null || !(entry instanceof KeyEntry)) {
|
||||
if (!(entry instanceof KeyEntry keyEntry)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// This call gives us a PKCS12 bag, with the key inside it.
|
||||
byte[] exportedKeyInfo = _getEncodedKeyData(((KeyEntry)entry).keyRef, password);
|
||||
byte[] exportedKeyInfo = _getEncodedKeyData(keyEntry.keyRef, password);
|
||||
if (exportedKeyInfo == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -273,11 +273,11 @@ public final class KeychainStore extends KeyStoreSpi {
|
|||
|
||||
Object entry = entries.get(alias.toLowerCase());
|
||||
|
||||
if (entry != null && entry instanceof KeyEntry) {
|
||||
if (((KeyEntry)entry).chain == null) {
|
||||
if (entry instanceof KeyEntry keyEntry) {
|
||||
if (keyEntry.chain == null) {
|
||||
return null;
|
||||
} else {
|
||||
return ((KeyEntry)entry).chain.clone();
|
||||
return keyEntry.chain.clone();
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
|
@ -569,11 +569,7 @@ public final class KeychainStore extends KeyStoreSpi {
|
|||
public boolean engineIsKeyEntry(String alias) {
|
||||
permissionCheck();
|
||||
Object entry = entries.get(alias.toLowerCase());
|
||||
if ((entry != null) && (entry instanceof KeyEntry)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return entry instanceof KeyEntry;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -586,11 +582,7 @@ public final class KeychainStore extends KeyStoreSpi {
|
|||
public boolean engineIsCertificateEntry(String alias) {
|
||||
permissionCheck();
|
||||
Object entry = entries.get(alias.toLowerCase());
|
||||
if ((entry != null) && (entry instanceof TrustedCertEntry)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return entry instanceof TrustedCertEntry;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue