8265426: Update java.security to use instanceof pattern variable

Reviewed-by: rriggs, weijun, dfuchs
This commit is contained in:
Patrick Concannon 2021-05-07 13:42:40 +00:00
parent 3fcdc50e44
commit 86b8dc9f5b
23 changed files with 85 additions and 165 deletions

View file

@ -1961,13 +1961,13 @@ public class KeyStore {
if ((type == null) || (file == null) || (protection == null)) {
throw new NullPointerException();
}
if ((protection instanceof PasswordProtection == false) &&
(protection instanceof CallbackHandlerProtection == false)) {
if (!(protection instanceof PasswordProtection) &&
!(protection instanceof CallbackHandlerProtection)) {
throw new IllegalArgumentException
("Protection must be PasswordProtection or " +
"CallbackHandlerProtection");
}
if (file.isFile() == false) {
if (!file.isFile()) {
throw new IllegalArgumentException
("File does not exist or it does not refer " +
"to a normal file: " + file);
@ -2056,7 +2056,7 @@ public class KeyStore {
PrivilegedExceptionAction<KeyStore> action =
new PrivilegedExceptionAction<KeyStore>() {
public KeyStore run() throws Exception {
if (protection instanceof CallbackHandlerProtection == false) {
if (!(protection instanceof CallbackHandlerProtection)) {
return run0();
}
// when using a CallbackHandler,
@ -2190,7 +2190,7 @@ public class KeyStore {
ks = KeyStore.getInstance(type, provider);
}
LoadStoreParameter param = new SimpleLoadStoreParameter(protection);
if (protection instanceof CallbackHandlerProtection == false) {
if (!(protection instanceof CallbackHandlerProtection)) {
ks.load(param);
} else {
// when using a CallbackHandler,